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 3/6] mm/hugetlb_vmemmap: drop the redundant hstate argument
Date: Tue, 1 Dec 2026 12:25:46 +0800 [thread overview]
Message-ID: <20261201042546.20746-1-lance.yang@linux.dev> (raw)
In-Reply-To: <20261124110530.3004071-4-songmuchun@bytedance.com>
On Tue, Nov 24, 2026 at 07:05:27PM +0800, Muchun Song wrote:
>The single-folio optimize path and the single- and multi-folio restore
>paths derive the vmemmap range, order, and NUMA node directly from each
>folio. Their hstate argument is therefore no longer used.
>
>Remove it from those paths and their internal helpers. Update the
>callers accordingly.
>
>Keep the hstate argument in the bulk optimize path so an ineligible
>hstate can be rejected before iterating and pteifying the folio list.
>
>No functional change intended.
>
>Signed-off-by: Muchun Song <songmuchun@bytedance.com>
>---
> mm/hugetlb.c | 12 ++++++------
> mm/hugetlb_vmemmap.c | 28 +++++++++++-----------------
> mm/hugetlb_vmemmap.h | 18 ++++++++----------
> 3 files changed, 25 insertions(+), 33 deletions(-)
>
>diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>index 0eddb8cee1eb..0475ee595406 100644
>--- a/mm/hugetlb.c
>+++ b/mm/hugetlb.c
>@@ -1519,7 +1519,7 @@ static void __update_and_free_hugetlb_folio(struct hstate *h,
> * is no longer identified as a hugetlb page. hugetlb_vmemmap_restore_folio
> * can only be passed hugetlb pages and will BUG otherwise.
> */
>- if (clear_flag && hugetlb_vmemmap_restore_folio(h, folio)) {
>+ if (clear_flag && hugetlb_vmemmap_restore_folio(folio)) {
> spin_lock_irq(&hugetlb_lock);
> /*
> * If we cannot allocate vmemmap pages, just refuse to free the
>@@ -1671,7 +1671,7 @@ static void bulk_vmemmap_restore_error(struct hstate *h,
> * be freed without restoring vmemmap.
> */
> if (folio_test_hugetlb(folio)) {
>- if (hugetlb_vmemmap_restore_folio(h, folio)) {
>+ if (hugetlb_vmemmap_restore_folio(folio)) {
> spin_lock_irq(&hugetlb_lock);
> add_hugetlb_folio(h, folio, true);
Wondered if we'd still need h when restore fails, but the caller already
has it for add_hugetlb_folio() :)
Nothing else jumped out at me, so:
Reviewed-by: Lance Yang <lance.yang@linux.dev>
next prev parent reply other threads:[~2026-12-01 4:25 UTC|newest]
Thread overview: 17+ 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 [this message]
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-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=20261201042546.20746-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