From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Hengbin Zhang <uqbarz@gmail.com>,
linux-mm@kvack.org, akpm@linux-foundation.org, ljs@kernel.org
Cc: ziy@nvidia.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] mm/thp: order huge zero folio PFN invalidation before removal
Date: Fri, 24 Jul 2026 20:48:42 +0200 [thread overview]
Message-ID: <177a1767-c782-4210-b377-44c520c74619@kernel.org> (raw)
In-Reply-To: <20260724100509.2300200-1-uqbarz@gmail.com>
Hi,
How was this issue identified or observed?
On 7/24/26 12:05, Hengbin Zhang wrote:
> The nonpersistent huge-zero shrinker removes huge_zero_folio with
> xchg() and then invalidates huge_zero_pfn. A concurrent fault can
> publish a new folio and its PFN between these operations, after which
> the old shrinker invalidates the new generation's PFN identity.
You mean, the freeing path does
1) xchg(&huge_zero_folio, NULL);
2) WRITE_ONCE(huge_zero_pfn, ~0UL);
Whereby the allocation path does
1) cmpxchg(&huge_zero_folio, NULL, zero_folio)
2) WRITE_ONCE(huge_zero_pfn, folio_pfn(zero_folio));
Sashiko also IMHO correctly complains about a missing barrier when we re-set the
refcount.
So I wonder whether we should just stop these cmpxch games and just use a
spinlock around updating huge_zero_folio+huge_zero_pfn?
--
Cheers,
David
next prev parent reply other threads:[~2026-07-24 18:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 10:05 Hengbin Zhang
2026-07-24 18:48 ` David Hildenbrand (Arm) [this message]
2026-07-27 13:18 ` [RFC PATCH v2] mm/thp: serialize huge-zero folio state transitions Hengbin Zhang
2026-07-27 13:40 ` David Hildenbrand (Arm)
2026-07-27 15:40 ` [RFC PATCH v3] " Hengbin Zhang
2026-07-27 15:42 ` Lorenzo Stoakes (ARM)
2026-07-27 16:08 ` David Hildenbrand (Arm)
2026-07-27 18:09 ` Lorenzo Stoakes (ARM)
2026-07-27 18:10 ` Lorenzo Stoakes (ARM)
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=177a1767-c782-4210-b377-44c520c74619@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=uqbarz@gmail.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®