Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.16 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796548648; b=pcOBDBqsXoquEFBc0rP7QseAWrjPmq9HNQiLp1V+9cgS4vy9QcXTAz48vyOGEkccBpWt 3i2eOpq5ZBDz80OZE9JbITak8gLluXjzhkdi1wA3UV2UjuV71ZOTfw7n1rQniEDQXjMHL 1pL1N4rNodKHR/JfHZC0blOpHEpxrwV4jbxOiF/RfdG6LDVFK8BI+UVCtl8THjd09aIt+ FadO+2XDiJqpYyLBD4aQQVhtu2pSm1CrMfkGgCZauqmHwF+D1j+e6LwfcypkJKdNptllr vK85hkjXnaI0NxUlv+4nUcUtAcWFrX4qCo+0x7ut2YRsIW7ycEjl1ttO7Mq3V30n8IA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796548648; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Content-Type:Mime-Version:Subject:From: In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References: To:X-Mailer; bh=a1wpQJJvFfed1VuaRXa79UaMbhrOF/MhevjAtQ4nKro=; b=TVO8DEwnf/mKaQHx37DWvZnVb2R3I7rz8WkIxG2/K4C6vLac7M6fL1uTtr0mtgMRRmvL pRCUZIWijIB/HdURlRpP306mM5YUc+4S0m+IzZ2c3V+dnuGLsiqw/+vjOPMsY4sTnrUiE S/LUMZuoGLBHrssqWIafg3oCvP9xKg1DGa91CB7xqkq7in/gEx2Bp3JntsvN0BUV+bXDB ImL3ji8DmAIDFa2UzIEaEsxw1lteSWp7mCdHLRHT0hxyLpf94i0xLdFfGhw3CzB2f6eL+ 2qZ02bfs5ymPuT460OjZffWt99fmyzXU52BxYBtUOEy/oV0Nfa7rrmrsBKQYoDIsiJg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b="P/pvjxE9"; arc=none smtp.remote-ip=95.215.58.16 Received: from mta1.migadu.com (out-16.mta1.migadu.com [95.215.58.16]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49D39606A322 for ; Sun, 6 Dec 2026 09:17:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 49D39606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=P/pvjxE9 X-Envelope-To: sashiko-reviews@lists.linux.dev DKIM-Signature: a=rsa-sha256; bh=lYQSeEwc1QNJbtgwAVyXwRzEhp73mzovB4EhaW//JtE=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796548645; v=1; x=1797153445; b=P/pvjxE906ScAANz1TwzU8EQ+aHaYfpFzbh1pTP3riEirsQwKCl/em8pC5J3EWGGm1FVDsGX a4r1Q5p7ih/mYHTyo/zJf9y2an2ZuteNn5tk8GkG2pJESu68zK0TX4gNfrikGjQ5ikIplKHq61a /XHOodDu1/Nftv5jA6jZfpQE= X-Envelope-To: sashiko-reviews@lists.linux.dev Received: by smtp.migadu.com with ESMTPS id 907772c65a7eb453; Sun, 06 Dec 2026 09:17:25 +0000 X-Mizu-Trace-ID: 907772c65a7eb453 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset=utf-8 X-Mailing-List: sashiko-reviews@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3901.200.71.1.16\)) Subject: Re: [PATCH v2 2/3] mm/vmemmap-optimization: track optimization state in shared vmemmap pages From: Muchun Song In-Reply-To: Date: Sun, 6 Dec 2026 17:17:09 +0800 Cc: Muchun Song , Muchun Song , Oscar Salvador , David Hildenbrand , Mike Rapoport , Andrew Morton , "Liam R . Howlett" , Vlastimil Babka , Michal Hocko , Miaohe Lin , Naoya Horiguchi , Lance Yang , Qi Zheng , linux-mm@kvack.org, Huacai Chen Content-Transfer-Encoding: quoted-printable Message-Id: <15E72DA7-F9BB-4A23-BB73-C8E4D799AB43@linux.dev> References: <20261206081324.8274-1-songmuchun@bytedance.com> <20261206081324.8274-3-songmuchun@bytedance.com> To: sashiko-reviews@lists.linux.dev X-Mailer: Apple Mail (2.3901.200.71.1.16) > On Dec 6, 2026, at 16:35, sashiko-bot@kernel.org wrote: >=20 > Thank you for your contribution! Sashiko AI review found 1 potential > issue to consider: > - [Low] mm: PAGEFLAG(VmemmapOptimized) exposes broken > folio_*_vmemmap_optimized() > -- >=20 > commit c7681d6be3397bd678ceb2f8b16aa0dc4585ed33 > Author: Muchun Song >=20 > mm/vmemmap-optimization: track optimization state in shared vmemmap = pages >=20 > This commit records vmemmap optimization state in PG_owner_priv_1 on = the > first struct page of each shared tail vmemmap backing page and adds > folio_vmemmap_optimized() to query it. >=20 >> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h >> index 2b8582838a4e2..377329a85151f 100644 >> --- a/include/linux/page-flags.h >> +++ b/include/linux/page-flags.h >=20 > [ ... ] >=20 >> @@ -692,6 +695,9 @@ PAGEFLAG(VmemmapSelfHosted, vmemmap_self_hosted, = PF_ANY) >> PAGEFLAG_FALSE(VmemmapSelfHosted, vmemmap_self_hosted) >> #endif >>=20 >> +/* Only test this flag through folio_vmemmap_optimized(). */ >> +PAGEFLAG(VmemmapOptimized, vmemmap_optimized, PF_ANY) >=20 > [Severity: Low] > Should PAGEFLAG() be avoided here so folio_test_vmemmap_optimized(), > folio_set_vmemmap_optimized(), and folio_clear_vmemmap_optimized() are = not > exposed? I had considered this as well. Initially, I looked for a macro that = could define only the page helpers, but all the available macros also generate folio = helpers, so I ended up using PAGEFLAG(). Nevertheless, I agree that PAGEFLAG() = should be avoided here to prevent the automatically generated folio_* helpers from = being misused in the future. I will replace it with page-only accessors in the = next revision. Thanks. >=20 > PAGEFLAG() with PF_ANY generates those folio_* helpers targeting page = index 0 > (the head page), where PG_vmemmap_optimized aliases PG_owner_priv_1 = and is > never set for vmemmap optimization. >=20 > Any caller using folio_test_vmemmap_optimized() will silently get = wrong > results (false on optimized folios and true on swapcache or checked = folios), > and the set/clear helpers will corrupt PG_owner_priv_1 on the head = page. >=20 > Defining page-only inline helpers (like PageAnonExclusive()) or = keeping the > bit manipulation internal to the vmemmap-optimization helpers would = avoid > exposing these broken folio_* helpers. >=20 > --=20 > Sashiko AI review =C2=B7 = https://sashiko.dev/#/patchset/20261206081324.8274-1-songmuchun@bytedance.= com?part=3D2