From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CB602459E1 for ; Thu, 20 Aug 2026 23:22:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787268151; cv=none; b=Grg0NU4zDzyapxm4PraHm+wCQ6TkyFZ2jtLNsssEGQF+zi8/JhEklQXHJEhJVlWBcWkZyRiBCg6heQFgXs1r/tTFDtBnqlCQyR5TxyaIgaNiuj4WiqsLOzj3yLkWYlbFX/e4DIB8uSlkpd1KYOqXWsGCrFgd0TTiU/dTUd2s1+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787268151; c=relaxed/simple; bh=naUFZk3bC4N8a5HICEoexMK5bhLh+FlLcECiF3r0jto=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kunKWawwB0rt7iTOuS2qxr+oFAjb+u7CWFAq4pZPWglDNaGAXICaavvTjUaAeQm7ogW0gHfRA2Esf85fdpq19h01BgjBsvW/wQTnjrXC6ZtYvkHN0G2dg4CPfqLwQSmdO97RRzJkVYtBGt2FTk+EQ2NTotjQAhZf9W8lU5GDm5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YyZSX/k/; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YyZSX/k/" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2cab973140bso5371855ad.3 for ; Thu, 20 Aug 2026 16:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787268150; x=1787872950; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=asT9cPmve6cmTnJFVNwrMzNjDioVMv1LtpS8TRSCILE=; b=YyZSX/k/Zs0ZdSoqcXdyQF+U4qgGhPGyzrzxoceE95k6hZo3sbO0gmN4eKEkEyvFNj 59wyN+w7TDDvX9zlxDQIoPr/m0I+kZXJkZKsElKrz1hgfCOBy8IydLHoJatzIR4Pljsa NpdaqzeAXKi9EIx20PXd0WL2ULEzXa/wBmO02tfLa6Sz5EeDHfkZUZXPk6+aPGbMu+Lu kXh0eeEuOxcqgOqd9plamzy1+7uzERAMb2bykR2aJQ9Ka16sJFwcE3a9Q52BmClaZj/G muHl8zNTcVNgHTLcVWdphRg9mL5MU+ni6iduFB50mivcph/kiDed2Y6si0hoOF9KxPtk hkkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787268150; x=1787872950; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=asT9cPmve6cmTnJFVNwrMzNjDioVMv1LtpS8TRSCILE=; b=rEqOyrrr1PvYyjMv1y/o8RfSiVCvzNRpM+rPRAlC3dExcRtG5w17azR4lDqPIcc3M+ n9jlooHohBD86fQ9fYUIFLiu5MVmfuNHtlrIi+uyK4KA6x3n7icoLerUG8UCtjNx/bj9 fl9yG9ZpdDDV3Ut9rdlrnVCybk51yZKi8KxBiITq4f0S/WeCF7x1woCtbKYYIuoKcDmg qySC+CmJTiwv3ZJfvuJbBZ9DJUqlfj7qIG0eGKudSnh8ldhzyfrukA9PO/ugoU4yIYwp V+YCu+oE3JFYqp8NiUSdTiBuTil0qLGHuoJ8iynBdqNu0gH+dp4IINa3mSDM8BKIrgXQ VJbw== X-Forwarded-Encrypted: i=1; AHgh+RoxCGPnmV1zTVTLe2K8lfKBKEaLNpppr+oESnK5BDQAHpUegQNC1vck8uqovm/S3tTFDMrkD5QE+yQ8PeA=@vger.kernel.org X-Gm-Message-State: AFuF++kVqH/nq5EKVxs43JV1OLMBstliAbUG6MtGojX8HWz7NXwZ/nk9 I+ZgpiuKJOxDwgh0CZkp3qptGrBCxnel7spHlrDWP1A1jh8/Hx5CkTgt X-Gm-Gg: AR+sD11DHgY1rnixGACP5XdLoELeIsCa9aOBmb7yq2vQ12j0sTCJ0mgpwMXytAiGUdf kUnrDbT3eST6Zz6TG5OQIIlW7taBTrwL3YyDX2JtiSGVwi1K3B1jPrRmlJtC7yLdXkoku3mE/sf SMSRcuUiEVIfQvbmeNf5Cra90Tr1uDX258eOTja7N+JGzxz6SJnpqXa63cPk7oMsIEBkRQY93Ag zjUxhzAAEwX6wh41hMTYcp6SbFLACA0HVAIO/TJHRHGYaxvaED1th51oVjiIRCbtmUTh6VHkxuc L1BAFO0a7hS1RPedgbQ/xCDeuVeOwb2cBxpH1ESHjL7zOiattEcbZxZ9Ge4xlKESc5JOwY+/ss7 cKIrz54CmEkyqOC1qdo+/I26k05BbD57/BLQdeBYfgQPWMQ8GZqSyJg48BZHIE34Yz6wF6Fji0R z5/szakv7i+S+eIZ/L+nWSXpalNAX25JjZBMgEwiFjsPwu9DZjCbpQNnD5ESdDGHz98tlLtT3V0 y8IpnQF X-Received: by 2002:a17:902:f552:b0:2d5:e3ce:3988 with SMTP id d9443c01a7336-2d64affbad3mr33244775ad.11.1787268149534; Thu, 20 Aug 2026 16:22:29 -0700 (PDT) Received: from v4bel ([58.123.110.97]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d62d5ae4a9sm12747335ad.32.2026.08.20.16.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2026 16:22:29 -0700 (PDT) Date: Fri, 21 Aug 2026 08:22:24 +0900 From: Hyunwoo Kim To: "Lorenzo Stoakes (ARM)" Cc: "David Hildenbrand (Arm)" , 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, imv4bel@gmail.com 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: On Mon, Aug 17, 2026 at 06:32:21PM +0100, Lorenzo Stoakes (ARM) wrote: > 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! That's okay :) Best regards, Hyunwoo Kim