LKML Archive on
help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <>
To: Qi Zheng <>
Subject: Re: [PATCH v2 2/2] mm: remove redundant smp_wmb()
Date: Wed, 1 Sep 2021 02:25:16 +0300	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Tue, Aug 31, 2021 at 09:21:11PM +0800, Qi Zheng wrote:
> The smp_wmb() which is in the __pte_alloc() is used to
> ensure all ptes setup is visible before the pte is made
> visible to other CPUs by being put into page tables. We
> only need this when the pte is actually populated, so
> move it to pmd_install(). __pte_alloc_kernel(),
> __p4d_alloc(), __pud_alloc() and __pmd_alloc() are similar
> to this case.
> We can also defer smp_wmb() to the place where the pmd entry
> is really populated by preallocated pte. There are two kinds
> of user of preallocated pte, one is filemap & finish_fault(),
> another is THP. The former does not need another smp_wmb()
> because the smp_wmb() has been done by pmd_install().
> Fortunately, the latter also does not need another smp_wmb()
> because there is already a smp_wmb() before populating the
> new pte when the THP uses a preallocated pte to split a huge
> pmd.
> Signed-off-by: Qi Zheng <>
> Reviewed-by: Muchun Song <>
> Acked-by: David Hildenbrand <>

Acked-by: Kirill A. Shutemov <>

 Kirill A. Shutemov

      reply	other threads:[~2021-08-31 23:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 13:21 [PATCH v2 0/2] Do some code cleanups related to mm Qi Zheng
2021-08-31 13:21 ` [PATCH v2 1/2] mm: introduce pmd_install() helper Qi Zheng
2021-08-31 23:23   ` Kirill A. Shutemov
2021-09-01 10:15     ` Qi Zheng
2021-08-31 13:21 ` [PATCH v2 2/2] mm: remove redundant smp_wmb() Qi Zheng
2021-08-31 23:25   ` Kirill A. Shutemov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v2 2/2] mm: remove redundant smp_wmb()' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).