Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Muchun Song" <songmuchun@bytedance.com>,
	"Oscar Salvador" <osalvador@suse.de>,
	"David Hildenbrand" <david@kernel.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Muchun Song" <muchun.song@linux.dev>,
	"Liam R . Howlett" <liam@infradead.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Michal Hocko" <mhocko@suse.com>,
	"Miaohe Lin" <linmiaohe@huawei.com>,
	"Naoya Horiguchi" <nao.horiguchi@gmail.com>,
	"Lance Yang" <lance.yang@linux.dev>,
	"Qi Zheng" <qi.zheng@linux.dev>,
	linux-mm@kvack.org, "Huacai Chen" <chenhuacai@kernel.org>
Subject: Re: [PATCH v2 2/3] mm/vmemmap-optimization: track optimization state in shared vmemmap pages
Date: Sun, 06 Dec 2026 08:35:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-252287@kernel.org> (raw)
In-Reply-To: <20261206081324.8274-3-songmuchun@bytedance.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mm: PAGEFLAG(VmemmapOptimized) exposes broken
  folio_*_vmemmap_optimized()
--

commit c7681d6be3397bd678ceb2f8b16aa0dc4585ed33
Author: Muchun Song <muchun.song@linux.dev>

mm/vmemmap-optimization: track optimization state in shared vmemmap pages

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.

> 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

[ ... ]

> @@ -692,6 +695,9 @@ PAGEFLAG(VmemmapSelfHosted, vmemmap_self_hosted, PF_ANY)
>  PAGEFLAG_FALSE(VmemmapSelfHosted, vmemmap_self_hosted)
>  #endif
>  
> +/* Only test this flag through folio_vmemmap_optimized(). */
> +PAGEFLAG(VmemmapOptimized, vmemmap_optimized, PF_ANY)

[Severity: Low]
Should PAGEFLAG() be avoided here so folio_test_vmemmap_optimized(),
folio_set_vmemmap_optimized(), and folio_clear_vmemmap_optimized() are not
exposed?

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.

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.

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.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206081324.8274-1-songmuchun@bytedance.com?part=2


  reply	other threads:[~2026-12-06  8:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06  8:13 [PATCH v2 0/3] mm: Track vmemmap optimization state in shared backing pages Muchun Song
2026-12-06  8:13 ` [PATCH v2 1/3] mm: move MAX_FOLIO_VMEMMAP_ALIGN to mmzone.h Muchun Song
2026-12-06  8:35   ` sashiko-bot
2026-12-06  8:13 ` [PATCH v2 2/3] mm/vmemmap-optimization: track optimization state in shared vmemmap pages Muchun Song
2026-12-06  8:35   ` sashiko-bot [this message]
2026-12-06  8:13 ` [PATCH v2 3/3] mm/hugetlb_vmemmap: remove HPG_vmemmap_optimized Muchun Song

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=sashiko-outbox-252287@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chenhuacai@kernel.org \
    --cc=david@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=nao.horiguchi@gmail.com \
    --cc=osalvador@suse.de \
    --cc=qi.zheng@linux.dev \
    --cc=rppt@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=songmuchun@bytedance.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