Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lance Yang <lance.yang@linux.dev>
To: songmuchun@bytedance.com
Cc: osalvador@suse.de, rppt@kernel.org, david@kernel.org,
	akpm@linux-foundation.org, muchun.song@linux.dev,
	lance.yang@linux.dev, qi.zheng@linux.dev, linux-mm@kvack.org
Subject: Re: [PATCH 5/6] mm/hugetlb_vmemmap: drop obsolete restore refcount warning
Date: Tue,  1 Dec 2026 12:57:25 +0800	[thread overview]
Message-ID: <20261201045725.32602-1-lance.yang@linux.dev> (raw)
In-Reply-To: <20261124110530.3004071-6-songmuchun@bytedance.com>


On Tue, Nov 24, 2026 at 07:05:29PM +0800, Muchun Song wrote:
>Commit bd225530a4c7 ("mm/hugetlb_vmemmap: fix race with speculative
>PFN walkers") added this warning alongside RCU protection that
>serialized page_ref_add_unless() against HVO remapping. The zero head
>refcount was part of that protocol while the vmemmap was folded or
>unfolded.
>
>That RCU protection was later removed by commit 32c440d67e6c ("mm:
>drop fake head checks") and commit 01b1d0ffb6f7 ("hugetlb: remove
>VMEMMAP_SYNCHRONIZE_RCU"). Commit 0120a603afad
>("mm/hugetlb_vmemmap: map the shared tail page writable") now handles
>the original race by allowing a late cmpxchg to fail safely against
>the zero refcount on the shared tail page.
>
>The head folio refcount no longer participates in this protection.
>Drop the stale warning from the restore path.
>
>Signed-off-by: Muchun Song <songmuchun@bytedance.com>
>---
> mm/hugetlb_vmemmap.c | 1 -
> 1 file changed, 1 deletion(-)
>
>diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
>index 7ede6b6fb4eb..d52e9d16d102 100644
>--- a/mm/hugetlb_vmemmap.c
>+++ b/mm/hugetlb_vmemmap.c
>@@ -408,7 +408,6 @@ static int __hugetlb_vmemmap_restore_folio(struct folio *folio, unsigned long fl
> 	int ret;
> 
> 	VM_WARN_ON_ONCE_FOLIO(!folio_test_hugetlb(folio), folio);
>-	VM_WARN_ON_ONCE_FOLIO(folio_ref_count(folio), folio);

Might be worth noting why the matching warning in vmemmap_optimize_folio()
stays.

vmemmap_restore_folio() skips the first vmemmap page (containing the
headstruct page), while vmemmap_optimize_folio() still copies and remaps
it :D

Reviewed-by: Lance Yang <lance.yang@linux.dev>


  reply	other threads:[~2026-12-01  4:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 11:05 [PATCH 0/6] mm: Simplify HugeTLB vmemmap optimization code Muchun Song
2026-11-24 11:05 ` [PATCH 1/6] mm/hugetlb_vmemmap: remove the vmemmap savings boot message Muchun Song
2026-11-24 11:16   ` sashiko-bot
2026-11-24 11:18     ` Muchun Song
2026-11-30 13:13   ` nobody
2026-11-30 13:15   ` Lance
2026-11-30 13:19   ` Lance Yang
2026-12-01  3:17     ` Muchun Song
2026-11-24 11:05 ` [PATCH 2/6] mm/hugetlb_vmemmap: fold vmemmap_should_optimize() into its callers Muchun Song
2026-12-01  2:51   ` Lance Yang
2026-12-01  3:11     ` Muchun Song
2026-11-24 11:05 ` [PATCH 3/6] mm/hugetlb_vmemmap: drop the redundant hstate argument Muchun Song
2026-12-01  4:25   ` Lance Yang
2026-11-24 11:05 ` [PATCH 4/6] mm/hugetlb_vmemmap: open-code free_vmemmap_page() Muchun Song
2026-12-01  4:35   ` Lance Yang
2026-11-24 11:05 ` [PATCH 5/6] mm/hugetlb_vmemmap: drop obsolete restore refcount warning Muchun Song
2026-12-01  4:57   ` Lance Yang [this message]
2026-11-24 11:05 ` [PATCH 6/6] mm/vmemmap-optimization: centralize the vmemmap optimization support check 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=20261201045725.32602-1-lance.yang@linux.dev \
    --to=lance.yang@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=qi.zheng@linux.dev \
    --cc=rppt@kernel.org \
    --cc=songmuchun@bytedance.com \
    /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