From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sourav Panda <souravpanda@google.com>
Cc: muchun.song@linux.dev, osalvador@suse.de,
akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
liam@infradead.org, vbabka@kernel.org, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, mhklinux@outlook.com,
fvdl@google.com, gthelen@google.com, mike.kravetz@oracle.com,
pasha.tatashin@soleen.com, rientjes@google.com, riel@surriel.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [RFC PATCH 0/6] mm/hugetlb: Dynamic, NUMA-aware HugePage Cache & Free Page Reporting
Date: Tue, 7 Jul 2026 02:56:54 -0400 [thread overview]
Message-ID: <20260707024744-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20260707064235.1386552-1-souravpanda@google.com>
On Tue, Jul 07, 2026 at 06:42:29AM +0000, Sourav Panda wrote:
> Overview
> This patch series introduces a dynamic, NUMA-aware HugePage Cache,
> backed by a kernel shrinker to safely return memory under pressure, and
> integrates it with Free Page Reporting (virtio-balloon) for HugeTLB,
> specifically targeting gigantic (1GB) hugepages. The goal is to solve
> the tradeoff between allocation latency and memory
> fungibility in virtualized and heterogeneous cloud environments.
>
> ---
>
> The Core Problem: Allocation Latency vs. Memory Fungibility
>
> With highly heterogeneous workloads, latency-critical applications demand
> gigantic hugepages. However, dynamic runtime allocation of 1GB pages
> from the buddy allocator (via CMA) is slow.
>
> To bypass this latency, operators often pre-allocate hugepages
> statically. However, this locks up the memory: when the HugeTLB
> workloads are idle, that memory is completely unavailable for other
> buddy-allocator workloads (e.g., page cache, anonymous memory). If buddy
> memory is exhausted, the system will OOM even if gigabytes of HugeTLB
> pages are sitting idle.
>
> This series resolves this challenge by delivering Dynamic Fungibility:
>
> 1. Dynamic Caching: Intercepts freed surplus hugepages and recycles
> them into a NUMA-aware cache instead of dissolving them immediately.
> 2. Fast Allocations: Satisfies subsequent dynamic allocations
> instantly from this warm, local hugepage cache.
> 3. Kernel Shrinker Integration: Registers a NUMA-aware kernel shrinker
> to dynamically dissolve cached pages back to the buddy allocator
> under memory pressure, restoring host/guest memory fungibility.
> 4. Free Page Reporting Integration: For virtualized environments (Guest
> VMs),
I was going to look into this part, thanks for working on this.
> cached pages trigger background Free Page Reporting via
> virtio-balloon. This allows the host to reclaim the physical memory
> while the guest retains its Vmemmap Optimization (HVO) metadata
> savings (~14GB saved per 1TB VM)!
Why "!" - that's 1.5%, seems surprisingly modest.
Are you sure it's working as intended?
> +---------------+ Slow Allocate +---------------------+
> | Buddy | ---------------> | Active HugeTLB Page |
> | Allocator | +---------------------+
> +---------------+ | ^
> ^ | (1) Free to | (2) Fast
> | (3) Under v Cache | Allocate
> | Pressure +---------------------+
> | Shrink() <------------------- | HugeTLB Cache |
> +---------------------+
> |
> v (4) Free Page Reporting
> (Host Reclaim in the case
> of virtualization)
>
> ---
>
> Patch Series Structure
>
> Patch 1/6: mm/hugetlb: add Kconfig and basic cache infrastructure
> - Introduces the CONFIG_HUGETLB_CACHE option, hstate tracking fields,
> and the HPG_cached page flag.
> - Establishes the clean helper API (hugetlb_folio_is_cached(),
> hugetlb_cache_remove(), hugetlb_cache_add()) and updates
> remove_hugetlb_folio() to be cache-aware, eliminating inline #ifdef
> blocks.
> Patch 2/6: mm/hugetlb: implement cache recycling and allocation
> - Hooks up recycling in free_huge_folio() (up to the cache limit) and
> allocation in alloc_surplus_hugetlb_folio().
> - Implements MRU allocation policy for maximum warmth, poison safety
> checks, and MTE/dcache cleaning.
> Patch 3/6: mm/hugetlb: add sysfs interfaces for cache
> - Exposes global and per-node sysfs attributes (max_cached_huge_pages,
> nr_cached_hugepages) for dynamic userspace control, including NUMA
> memory policy scaling.
> - Supports dynamic delta adjustments (+1/-1) to safely scale cache
> sizes alongside concurrent background reclaim operations.
> Patch 4/6: mm/hugetlb: add memory shrinker for cache
> - Registers a NUMA-aware kernel shrinker to evict and dissolve cached
> gigantic pages back to buddy under memory pressure.
> Patch 5/6: Documentation/admin-guide/mm/hugetlbpage.rst: document cache
> interfaces
> - Documents the Kconfig option, sysfs attributes, and shrinker
> behavior in the admin guide.
> Patch 6/6: mm/hugetlb: support free page reporting for cached hugepages
> - Integrates the cache with the Free Page Reporting framework (virtio-
> balloon), introducing the HPG_reported flag and the
> reporting/isolation/draining lifecycle.
> Sourav Panda (6):
> mm/hugetlb: add Kconfig and basic cache infrastructure
> mm/hugetlb: implement cache recycling and allocation
> mm/hugetlb: add sysfs interfaces for cache
> mm/hugetlb: add memory shrinker for cache
> Documentation/admin-guide/mm/hugetlbpage.rst: document cache
> interfaces
> mm/hugetlb: support free page reporting for cached hugepages
>
> Documentation/admin-guide/mm/hugetlbpage.rst | 34 +-
> fs/Kconfig | 9 +
> include/linux/hugetlb.h | 45 ++
> include/linux/page_reporting.h | 1 +
> mm/hugetlb.c | 590 ++++++++++++++++++-
> mm/hugetlb_internal.h | 9 +
> mm/hugetlb_sysfs.c | 158 +++++
> mm/page_reporting.c | 10 +-
> mm/page_reporting.h | 6 +
> 9 files changed, 844 insertions(+), 18 deletions(-)
>
> --
> 2.55.0.rc0.799.gd6f94ed593-goog
next prev parent reply other threads:[~2026-07-07 6:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 6:42 [RFC PATCH 0/6] mm/hugetlb: Dynamic, NUMA-aware HugePage Cache & Free Page Reporting Sourav Panda
2026-07-07 6:42 ` [PATCH 1/6] mm/hugetlb: add Kconfig and basic cache infrastructure Sourav Panda
2026-07-07 6:42 ` [PATCH 2/6] mm/hugetlb: implement cache recycling and allocation Sourav Panda
2026-07-07 6:42 ` [PATCH 3/6] mm/hugetlb: add sysfs interfaces for cache Sourav Panda
2026-07-07 6:42 ` [PATCH 4/6] mm/hugetlb: add memory shrinker " Sourav Panda
2026-07-07 6:42 ` [PATCH 5/6] Documentation/admin-guide/mm/hugetlbpage.rst: document cache interfaces Sourav Panda
2026-07-07 6:42 ` [PATCH 6/6] mm/hugetlb: support free page reporting for cached hugepages Sourav Panda
2026-07-07 7:18 ` Michael S. Tsirkin
2026-07-07 10:18 ` Michael S. Tsirkin
2026-07-07 6:56 ` Michael S. Tsirkin [this message]
2026-07-07 7:21 ` [RFC PATCH 0/6] mm/hugetlb: Dynamic, NUMA-aware HugePage Cache & Free Page Reporting Sourav Panda
2026-07-07 7:29 ` David Hildenbrand (Arm)
2026-07-07 8:09 ` Muchun Song
2026-07-07 10:25 ` Michael S. Tsirkin
2026-07-07 10:28 ` David Hildenbrand (Arm)
2026-07-07 11:06 ` Lorenzo Stoakes
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=20260707024744-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=fvdl@google.com \
--cc=gthelen@google.com \
--cc=liam@infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhklinux@outlook.com \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
--cc=pasha.tatashin@soleen.com \
--cc=riel@surriel.com \
--cc=rientjes@google.com \
--cc=rppt@kernel.org \
--cc=souravpanda@google.com \
--cc=surenb@google.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