From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Gregory Price <gourry@gourry.net>, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
akpm@linux-foundation.org, ziy@nvidia.com,
matthew.brost@intel.com, joshua.hahnjy@gmail.com,
rakie.kim@sk.com, byungchul@sk.com, ying.huang@linux.alibaba.com,
apopple@nvidia.com, urezki@gmail.com, chenwandun@huawei.com,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH 1/2] mm/mempolicy: use SRCU for the weighted interleave state
Date: Wed, 16 Sep 2026 17:48:11 +0200 [thread overview]
Message-ID: <7560715f-43fc-46ec-a860-4cc63ac4e51f@kernel.org> (raw)
In-Reply-To: <20260829015943.1258774-2-gourry@gourry.net>
On 8/29/26 03:59, Gregory Price wrote:
> alloc_pages_bulk_weighted_interleave() copies iw_table into a scratch
> array on every call so it can walk the weights outside of RCU. The copy
> exists only because the loop may sleep in the page allocator and so cannot
> hold rcu_read_lock().
>
> Use SRCU to pin the global iw_table object and use it in-place instead.
>
> Retire through both flavors - call_srcu() for the sleeping readers, then
> kfree_rcu() for the reference-less ones - so writers no longer block on
> synchronize_rcu() either.
>
> Tested in a VM with KASAN, PROVE_LOCKING and DEBUG_OBJECTS_RCU_HEAD,
> with a udelay() injected into the read section to widen the race against
> concurrent sysfs weight writers, and placement checked against the
> configured weights.
>
> Every retired state reached its callback. Swapping the deferred free for
> a bare kfree() in the same test reports a use-after-free immediately.
>
> Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> Suggested-by: Matthew Wilcox <willy@infradead.org>
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
> ---
LGTM
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
next prev parent reply other threads:[~2026-09-16 15:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-29 1:59 [PATCH 0/2] mm/mempolicy: stop copying state in the interleave paths Gregory Price
2026-08-29 1:59 ` [PATCH 1/2] mm/mempolicy: use SRCU for the weighted interleave state Gregory Price
2026-09-16 15:48 ` David Hildenbrand (Arm) [this message]
2026-08-29 1:59 ` [PATCH 2/2] mm/mempolicy: stop copying the nodemask in the interleave paths Gregory Price
2026-09-02 9:00 ` Rakie Kim
2026-09-02 14:52 ` Gregory Price
2026-09-04 8:01 ` Rakie Kim
2026-09-04 15:50 ` Gregory Price
2026-09-07 8:57 ` Rakie Kim
2026-09-16 15:57 ` David Hildenbrand (Arm)
2026-09-16 16:27 ` Gregory Price
2026-09-17 9:49 ` David Hildenbrand (Arm)
2026-09-17 11:33 ` Gregory Price
2026-08-29 23:18 ` [PATCH 0/2] mm/mempolicy: stop copying state " Andrew Morton
2026-08-30 16:39 ` Gregory Price
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=7560715f-43fc-46ec-a860-4cc63ac4e51f@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=byungchul@sk.com \
--cc=chenwandun@huawei.com \
--cc=gourry@gourry.net \
--cc=joshua.hahnjy@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=matthew.brost@intel.com \
--cc=rakie.kim@sk.com \
--cc=urezki@gmail.com \
--cc=willy@infradead.org \
--cc=ying.huang@linux.alibaba.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®