From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Gregory Price <gourry@gourry.net>
Cc: linux-mm@kvack.org, 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
Subject: Re: [PATCH 2/2] mm/mempolicy: stop copying the nodemask in the interleave paths
Date: Thu, 17 Sep 2026 11:49:52 +0200 [thread overview]
Message-ID: <7eb8f4c0-6e14-4f91-a3b9-77e82f76ed00@kernel.org> (raw)
In-Reply-To: <aqq_yv-cQvzuxr5D@gourry-fedora-PF4VCD3F>
On 9/16/26 18:27, Gregory Price wrote:
> On Wed, Sep 16, 2026 at 05:57:22PM +0200, David Hildenbrand (Arm) wrote:
>> On 8/29/26 03:59, Gregory Price wrote:
>>> The interleave node selectors copy pol->nodes onto the stack so the mask
>>> cannot change while they walk it. nodemask_t is 128 bytes at
>>> MAX_NUMNODES=1024, and two of the three run per folio fault.
>>>
>>> The copy only buys consistency between the node count and the walk.
>>> Drop the consistency and just bounds check the walk instead.
>>
>> I think you should document here that accessing the node bitnmap is safe (is RCU
>> responsible for that? I think yes), but it can get updated concurrently.
>>
>
> Actually, not quite.
>
> RCU stabilizes the weights and makes accessing them safe. RCU doesn't
> help us with the node bitmasks themselves (we were using a cpuset cookie
> to stabilize them to take a copy - but we're killin that here).
Ah, my memory comes back. So confusing.
>
> What makes it safe is that we detect the torn read condition (check for
> an empty nodemask) and otherwise don't care about weight skews in the
> weighted variant.
>
> I think it's reasonable to add a couple comments to spell out.
>
> Are you ok if I just spin an additional commit to tack on rather than
> spin a new version just for comments?
A resend is probably easiest when modifying the commit message.
For adding more code comments an inline patch we can squash is also good enough.
(I prefer a resend because that shows the full clean picture, but without actual
code changes I don't care that much)
--
Cheers,
David
next prev parent reply other threads:[~2026-09-17 9:49 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 " 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)
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) [this message]
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=7eb8f4c0-6e14-4f91-a3b9-77e82f76ed00@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=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®