From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Hyunwoo Kim <imv4bel@gmail.com>,
akpm@linux-foundation.org, liam@infradead.org,
vbabka@kernel.org, rppt@kernel.org, surenb@google.com,
mhocko@suse.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] selftests/mm: add stale walk->action race test
Date: Tue, 11 Aug 2026 19:23:56 +0100 [thread overview]
Message-ID: <antoRbvwXVxoQ7Dw@gremlin> (raw)
In-Reply-To: <b27f03ea-414a-4ae5-9649-2a05398fe082@kernel.org>
On Tue, Aug 11, 2026 at 07:11:59PM +0200, David Hildenbrand (Arm) wrote:
> On 8/11/26 18:18, Hyunwoo Kim wrote:
> > The added pagewalk_race_test maps two PMDs and faults in 2MB of the first
> > one. A second thread then faults in the second PMD and drops it again with
> > MADV_DONTNEED in a loop, while the main thread reads Rss for the mapping
> > from /proc/self/smaps.
> >
> > Clearing the second PMD while smaps_pte_range() runs leaves walk->action
> > erroneously set to ACTION_AGAIN, which causes the PUD walk to be retried,
> > so the first PMD is counted twice and Rss comes out twice as large as what
> > was faulted in.
> >
> > mincore() is the caller named in the fix, but the second walk writes past
> > the length mincore() copies back, so it cannot be seen from userspace
> > there. smaps reports what the callbacks counted, so the duplicate shows up
> > in Rss.
> >
> > A failure can only come from the kernel counting the same page twice, so
> > missing the race is harmless. On an unfixed kernel the test fails after a
> > few hundred reads at most and takes about half a second.
> >
> > Assisted-by: Claude:claude-opus-5
> > Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
> > ---
>
> I'm sorry, but I don't consider such a specialized reproducer for a problem we
> hit once a good fit for a selftest.
>
> Or am I missing something, that this here is more generic?
To be fair I did ask him for this. :)
I thought it would be useful to have a regression test because there's certainly
no harm in it? The code is very sensitive and catching a similar mistake in
future could be useful.
If you're sure this isn't valuable then he could just drop it, but it's my fault
sorry Hyunwoo for giving you extra work in this case! My bad.
>
> --
> Cheers,
>
> David
--
Cheers, Lorenzo
next prev parent reply other threads:[~2026-08-11 18:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 16:18 [PATCH v2 0/2] mm/pagewalk: fix stale walk->action escaping walk_pmd_range() Hyunwoo Kim
2026-08-11 16:18 ` [PATCH v2 1/2] " Hyunwoo Kim
2026-08-11 16:23 ` Lorenzo Stoakes (ARM)
2026-08-11 17:10 ` David Hildenbrand (Arm)
2026-08-11 19:37 ` Andrew Morton
2026-08-11 20:17 ` Hyunwoo Kim
2026-08-11 21:57 ` Andrew Morton
2026-08-11 16:18 ` [PATCH v2 2/2] selftests/mm: add stale walk->action race test Hyunwoo Kim
2026-08-11 16:33 ` Lorenzo Stoakes (ARM)
2026-08-11 17:11 ` David Hildenbrand (Arm)
2026-08-11 18:23 ` Lorenzo Stoakes (ARM) [this message]
2026-08-11 18:49 ` David Hildenbrand (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=antoRbvwXVxoQ7Dw@gremlin \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=imv4bel@gmail.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/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