From: Muchun Song <muchun.song@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Muchun Song <songmuchun@bytedance.com>,
Oscar Salvador <osalvador@suse.de>,
Mike Rapoport <rppt@kernel.org>, Qi Zheng <qi.zheng@linux.dev>,
Lance Yang <lance.yang@linux.dev>,
James Houghton <jthoughton@google.com>,
David Hildenbrand <david@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 00/12] mm: Decouple folio-based vmemmap optimization from HugeTLB
Date: Wed, 4 Nov 2026 14:55:14 +0800 [thread overview]
Message-ID: <77ECD6F3-6A6B-4743-B47E-7C97335FAA79@linux.dev> (raw)
In-Reply-To: <20261103224659.2865b9ff27d09994949edd78@linux-foundation.org>
> On Nov 4, 2026, at 14:46, Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Wed, 4 Nov 2026 10:34:58 +0800 Muchun Song <songmuchun@bytedance.com> wrote:
>
>> Hi,
>>
>> Section-based vmemmap optimization is implemented in sparse-vmemmap.c,
>> while folio-based optimization currently lives in hugetlb_vmemmap.c.
>> The latter is tightly coupled to HugeTLB-specific state even though the
>> underlying page-table remapping operates on one folio at a time.
>>
>> To make these interfaces easier to maintain, the folio-based remapping
>> mechanics first need a boundary that is independent of HugeTLB-specific
>> state and raw address ranges. This will allow the mechanics to be moved
>> into a common vmemmap optimization layer alongside the section-based
>> interface.
>>
>> This series establishes that boundary through three folio-oriented
>> operations, each with a distinct role:
>>
>> - vmemmap_optimize_folio() optimizes the vmemmap backing of a folio;
>> - vmemmap_restore_folio() restores the vmemmap backing of a folio; and
>> - vmemmap_pteify_folio() converts the vmemmap backing of a folio to
>> PTE mappings.
>>
>> Together, these operations encapsulate the address-range calculation and
>> remapping mechanics for a folio. HugeTLB wrappers retain policy decisions
>> such as eligibility, optimized state, batching and TLB flush handling.
>>
>> Patches 1-8 generalize the underlying vmemmap remapping infrastructure by
>> removing HugeTLB-specific assumptions and simplifying remap control and
>> resource handling. Patches 9-12 then establish folio-oriented operations
>> for optimization, restoration and PTE conversion.
>>
>> The implementation remains in hugetlb_vmemmap.c for now. A follow-up can
>> move the folio-based operations into the common vmemmap optimization layer
>> once the interface boundary is in place.
>>
>
> Thanks. I fed this into my evolving LLM-controlled testing setup and it
> said
>
> : I tested all twelve patches together in an x86-64 Debian VM under
> : QEMU/KVM, with 4 KiB base pages and KASAN enabled.
> :
> : I grew the pool by 64 two-MiB huge pages and drained it again. With
> : vmemmap optimization enabled, the kernel released 448 vmemmap pages
> : on growth and restored all 448 on shrink, in each of three cycles.
> : With optimization disabled, the vmemmap count stayed constant. I also
> : faulted in a single surplus huge page. It released seven vmemmap pages
> : and restored all seven when I unmapped it.
> :
> : I tested both boot-reserved and runtime-allocated 1 GiB huge pages.
> : For the runtime case, I grew the pool from zero to one, drained it,
> : and allocated again. I mapped the page and wrote and verified a byte
> : in every 4 KiB base page. After unmapping it, I demoted it to 512
> : two-MiB huge pages and drained the resulting pool.
> :
> : All twelve programs in the HugeTLB selftest group passed, including
> : the cgroup reservation, fault-charge and reparenting tests. Both
> : soft-offline cases passed, as did all twelve poisoned-page read test
> : cases. I saw no HugeTLB warnings or KASAN reports.
> :
> : On a diagnostic build, I failed the head-page allocation and, in a
> : separate run, interrupted optimization after three PTEs had changed.
> : The trace showed rollback restoring the two tail entries to distinct
> : backing pages. The folio remained usable in both runs. I also failed
> : restoration after three of seven replacement pages had been allocated.
> : All three were freed, the retry succeeded, and the metadata count
> : returned to its starting value.
> :
> : I configured QEMU with two virtual NUMA nodes, each with two vCPUs
> : and 4 GiB of RAM. On each node, I forced the batched pre-split to
> : fail. The trace showed the remap splitting the same PMD and completing
> : a range flush before replacing its first PTE. Folios on each node
> : shared a tail backing page distinct from the other node's. I drained
> : each node's pool in turn and verified data in a live folio on the other.
> :
> : Finally, on the kernel without diagnostic hooks, I grew and drained
> : both pools during active page-cache reclaim. Over 40 cycles all 640
> : folios optimized and restored, and the OOM-kill count stayed flat.
Really a thorough set of tests.
> :
> : Tested-by: Andrew Morton <akpm@linux-foundation.org>
Thanks for testing.
Muchun
prev parent reply other threads:[~2026-11-04 6:55 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 2:34 Muchun Song
2026-11-04 2:34 ` [PATCH v3 01/12] mm: hugetlb_vmemmap: remove HugeTLB-specific vmemmap optimization macros Muchun Song
2026-11-04 9:15 ` Oscar Salvador (SUSE)
2026-11-04 2:35 ` [PATCH v3 02/12] mm: hugetlb_vmemmap: unify VMEMMAP_{SPLIT,REMAP}_NO_TLB_FLUSH Muchun Song
2026-11-04 9:22 ` Oscar Salvador (SUSE)
2026-11-04 11:06 ` Mike Rapoport
2026-11-04 2:35 ` [PATCH v3 03/12] mm: hugetlb_vmemmap: simplify vmemmap head page handling Muchun Song
2026-11-04 9:40 ` Oscar Salvador (SUSE)
2026-11-04 2:35 ` [PATCH v3 04/12] mm: hugetlb_vmemmap: generalize vmemmap page allocation Muchun Song
2026-11-04 9:58 ` Oscar Salvador (SUSE)
2026-11-04 11:14 ` Muchun Song
2026-11-04 11:06 ` Mike Rapoport
2026-11-04 2:35 ` [PATCH v3 05/12] mm: hugetlb_vmemmap: unify writable vmemmap page preparation Muchun Song
2026-11-04 10:02 ` Oscar Salvador (SUSE)
2026-11-04 2:35 ` [PATCH v3 06/12] mm: hugetlb_vmemmap: rename vmemmap_remap_pte() to vmemmap_optimize_pte() Muchun Song
2026-11-04 10:04 ` Oscar Salvador (SUSE)
2026-11-04 2:35 ` [PATCH v3 07/12] mm: hugetlb_vmemmap: simplify shared tail page handling Muchun Song
2026-11-04 10:31 ` Oscar Salvador (SUSE)
2026-11-04 2:35 ` [PATCH v3 08/12] mm: hugetlb_vmemmap: move alloc_vmemmap_page_list() next to its free helper Muchun Song
2026-11-04 10:36 ` Oscar Salvador (SUSE)
2026-11-04 2:35 ` [PATCH v3 09/12] mm: hugetlb_vmemmap: make vmemmap optimization folio-oriented Muchun Song
2026-11-04 12:39 ` Oscar Salvador (SUSE)
2026-11-04 2:35 ` [PATCH v3 10/12] mm: hugetlb_vmemmap: make vmemmap restoration folio-oriented Muchun Song
2026-11-04 13:12 ` Oscar Salvador (SUSE)
2026-11-04 2:35 ` [PATCH v3 11/12] mm: hugetlb_vmemmap: unify vmemmap range restoration Muchun Song
2026-11-04 13:42 ` Oscar Salvador (SUSE)
2026-11-04 2:35 ` [PATCH v3 12/12] mm: hugetlb_vmemmap: make vmemmap PTE conversion folio-oriented Muchun Song
2026-11-04 6:46 ` [PATCH v3 00/12] mm: Decouple folio-based vmemmap optimization from HugeTLB Andrew Morton
2026-11-04 6:55 ` Muchun Song [this message]
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=77ECD6F3-6A6B-4743-B47E-7C97335FAA79@linux.dev \
--to=muchun.song@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jthoughton@google.com \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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
all inboxes | Powered by JetHome®