From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 274FC440A0C for ; Mon, 17 Aug 2026 17:32:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786987947; cv=none; b=jh/c2ZHsIA399tYYiUVSZaxEZzk5q5UxYjGvpEnesH+LBUXWa4pjvuthUvXu6lNTCjUqKbpMWR99xBQ1vbVfMzvfz4D5/nx7yiwd/8vq0sgduetYjY8V2qfxIvivlXN9psqwVmti7XgsRvxHfsjGMe/ZS3oXrNH9KUgbLtsGyoo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786987947; c=relaxed/simple; bh=J9zbGYEZwRbnQx79ZzbRNWFOhQx3oWbZIgNll9T7xhI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZuyC7MqIb9dz8x04b4Ps1/ahrlUIYdwDSrNCDzdCionkJ69LKfORJN9O3QJyYhPvs/BtMEJu+/j6OMOYEqINPIxbyZrTW014NQqtDNC5CqSZcWzuSiukYNAOeox9yb+Nje6XhipL1d7EI3iLZpPfqnO4cdbckNHopladsx91yw0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Iq975uFa; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Iq975uFa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE62C1F000E9; Mon, 17 Aug 2026 17:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786987945; bh=MN6diR8GeSzCKvRRKh/mD2MDugE3edYYYYNW6HjYy5U=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Iq975uFaNu656a5p36jXXMjkHcwIWAaCrKJvkDmPJqkG+AiuoiVfT2HC5ckbW7Id1 OCg0Jt5MdWWmhCyJPkdwx8+HhjKQFNuwa7GX1vRdMTvINpRD/iljBeOni4uUNlKzFx y9i6vdn+N8t8b/BY54ez+38Bv/CenWXCcLqs96UA5NvTwUjL8gWPbXRiMoHiP1KLJl Bke4GkqrAJtxrpVDE/6yOA/FEH+irgYxYGWqwb9DqoD1Sd/NsL3MnZgsZt7kISiA6e bzF9kOeVcap8oaZ5mDTU3rQTB5dSLNOrgvFymPxxt8f8ycJ/yMYAfN6eH49WGWx/Uj wQVfDV7WK9vEQ== Date: Mon, 17 Aug 2026 18:32:21 +0100 From: "Lorenzo Stoakes (ARM)" To: "David Hildenbrand (Arm)" Cc: Hyunwoo Kim , 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 Message-ID: References: <20260811161949.3879321-1-imv4bel@gmail.com> <20260811161949.3879321-3-imv4bel@gmail.com> <0ec056ff-222c-42a4-a737-0bd65d1f0a93@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0ec056ff-222c-42a4-a737-0bd65d1f0a93@kernel.org> On Tue, Aug 11, 2026 at 08:49:46PM +0200, David Hildenbrand (Arm) wrote: > On 8/11/26 20:23, Lorenzo Stoakes (ARM) wrote: > > 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 > >>> --- > >> > >> 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. > > pagewalk_race_test is just rather odd. If this would be part of a bigger test > that covers more things than just one odd race, it might be better. > > But we certainly don't want one new test file for each kernel bug we ever > trigger, right? :) Right yeah :) sure we can drop this then. Sorry Hyunwoo! > > -- > Cheers, > > David -- Cheers, Lorenzo