From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from flow-a7-smtp.messagingengine.com (flow-a7-smtp.messagingengine.com [103.168.172.142]) (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 B497530FC03 for ; Wed, 11 Feb 2026 11:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770807825; cv=none; b=shlWIqZ0EmgAYfj30Hsh3L08jRy8xixoHE9sG84cjMqVDPDxIlx69xYpBMxo6AkMfm69zzmwiyxpFWZ4dZA5E+1T46l/LLIKVOsP1xdS35Nq85SmRomFi2nDshXnsL82nu1Lq9KerQ0jZ7NpfqkaFoW2saYDzL5kN+KPc+mXcSg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770807825; c=relaxed/simple; bh=1M0IzWmr5ViYg0kEUfidxw7p5G85tRv7M+Mrx/f+XpM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ubWpHe/aFiRarh//GJzbGhoORyWYGISkKiXiId6DKdBWCwa3ibPSu3OMNus7SLDtODjQOmr45/rH/2SOvcDrdc+xBXF7cURCuFrOe32y9t9I2z4x1W37TgQQ1DYpF/TFTHGwqoiNDHKm5vxa7KuH7a9cE0+ZtZ7Cf2lYrmluzqs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name; spf=pass smtp.mailfrom=shutemov.name; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b=DX5/1Dnn; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=VnJ/13GX; arc=none smtp.client-ip=103.168.172.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shutemov.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b="DX5/1Dnn"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="VnJ/13GX" Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48]) by mailflow.phl.internal (Postfix) with ESMTP id B3C8F1380956; Wed, 11 Feb 2026 06:03:42 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Wed, 11 Feb 2026 06:03:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1770807822; x=1770815022; bh=K8myth/ue+5MR9IOMUfT7evtyMaEFtxl lmMmJKcsp9I=; b=DX5/1Dnnh2meaF/W8AjiVi9F4k9E+hSu0MnX89p8qMeS/ENL DSTXvE6N/of5N5/3Pozwt+TXZeTwZSsP1qqCZANGX1hIB1/aQ0CvIy6t8uerlNMi pZSrGOUmgxOwjXgvwuBy9JRMelkFrlYGK9YTLM9gEtGLrDHLMtQ8udAQCvoEiIlN VyXtvEkVzRVNr7JXV3VpV5l5GrnbsHpgF4Tbb73u5v7EiEq1whOwJrB+neb28U8U rVeWW/1qpT8vAqm4Ma8SouvKUCf0Q/E8gZYNL77FpuMxH2chSgZd0W6UIJ2aS6Yd 9EaldvZBPxaGUP73YbbawzexH6/hjWJCwJpHLg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1770807822; x= 1770815022; bh=K8myth/ue+5MR9IOMUfT7evtyMaEFtxllmMmJKcsp9I=; b=V nJ/13GXM9fLjSApk9IFcOu4egL6+bBpNPTw/J/IubTeeEYZXO7IdVAvgN4kUq9X1 whNLe58ZviFT1lxRXMLOXcU4mdJzQLQKYxLOG+IMJDSHR8H3gSflh++gDkDFey7d B4JX53DQg+QXAkymaKrPkSeWhb1c72dgRIQR6ljsG6xCntFs4B3PT2fofg9dpTxC m0kc5tuGL5bLewjjscv43qZ7eUkeAVg4gw8vejMKjWpyjJg7c4E8YHzSxefQDzXc 0V4XpTxzbDxs7Tj2inrOuQxouSToQAXxSBwmL8hrT8BLLAZZXnIO0P34CVzauQOF oo9Ou5t/kvOywMcDUu5MQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvtddvfeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdejnecuhfhrohhmpefmihhrhihl ucfuhhhuthhsvghmrghuuceokhhirhhilhhlsehshhhuthgvmhhovhdrnhgrmhgvqeenuc ggtffrrghtthgvrhhnpeeltdefvedvteeuuefhvdeutdetheefueethefgheegteeihfev jefgvddujeeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehkihhrihhllhesshhhuhhtvghmohhvrdhnrghmvgdpnhgspghrtghpthhtohep vddvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehhrghofigvnhgthhgrohdvvd esghhmrghilhdrtghomhdprhgtphhtthhopegrkhhpmheslhhinhhugidqfhhouhhnuggr thhiohhnrdhorhhgpdhrtghpthhtohepuggrvhhiugeskhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhorhgvnhiiohdrshhtohgrkhgvshesohhrrggtlhgvrdgtohhmpdhrtghp thhtoheplhhirghmrdhhohiflhgvthhtsehorhgrtghlvgdrtghomhdprhgtphhtthhope hvsggrsghkrgesshhushgvrdgtiidprhgtphhtthhopehrphhptheskhgvrhhnvghlrdho rhhgpdhrtghpthhtohepshhurhgvnhgssehgohhoghhlvgdrtghomhdprhgtphhtthhope hmhhhotghkohesshhushgvrdgtohhm X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Feb 2026 06:03:41 -0500 (EST) Date: Wed, 11 Feb 2026 11:03:35 +0000 From: Kiryl Shutsemau To: Wenchao Hao Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] mm: only set fault addrsss' access bit in do_anonymous_page Message-ID: References: <20260210043456.2137482-1-haowenchao22@gmail.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Feb 11, 2026 at 09:00:45AM +0800, Wenchao Hao wrote: > On Tue, Feb 10, 2026 at 7:56 PM Kiryl Shutsemau wrote: > > > > On Tue, Feb 10, 2026 at 12:34:56PM +0800, Wenchao Hao wrote: > > > When do_anonymous_page() creates mappings for huge pages, it currently sets > > > the access bit for all mapped PTEs (Page Table Entries) by default. > > > > > > This causes an issue where the Referenced field in /proc/pid/smaps cannot > > > distinguish whether a page was actually accessed. > > > > > > So here introduces a new interface, set_anon_ptes(), which only sets the > > > access bit for the PTE corresponding to the faulting address. This allows > > > accurate tracking of page access status in /proc/pid/smaps before memory > > > reclaim scan the folios. > > > > > > During memory reclaim: folio_referenced() checks and clears the access bits > > > of PTEs, rmap verifies all PTEs under a folio. If any PTE mapped subpage of > > > folio has access bit set, the folio is retained during reclaim. So only > > > set the access bit for the faulting PTE in do_anonymous_page() is safe, as > > > it does not interfere with reclaim decisions. > > > > We had similar discussion about faultaround and briefly made it produce > > old ptes, but it caused performance regression as old ptes require > > additional pagewalk to set accessed bit on touch. It got reverted, > > but arch can opt-in for setting up old ptes for non-fault address. > > > > See commits: > > > > 5c0a85fad949 ("mm: make faultaround produce old ptes") > > 315d09bf30c2 ("Revert "mm: make faultaround produce old ptes"") > > 46bdb4277f98 ("mm: Allow architectures to request 'old' entries when prefaulting") > > > It does look similar—our modifications both revolve around whether pre-mapped > PTEs should be marked as "new." > > Was there any analysis into why your changes led to performance regressions? As I mentioned, my theory was that it is due to an additional pagewalks CPU has to do to flip access bit when it touches the memory, but I didn't profile it to confirm. -- Kiryl Shutsemau / Kirill A. Shutemov