The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>, Qi Zheng <qi.zheng@linux.dev>,
	 akpm@linux-foundation.org, baolin.wang@linux.alibaba.com,
	liam@infradead.org,  npache@redhat.com, ryan.roberts@arm.com,
	dev.jain@arm.com, baohua@kernel.org,  lance.yang@linux.dev,
	muchun.song@linux.dev, osalvador@suse.de, chrisl@kernel.org,
	 kasong@tencent.com, shikemeng@huaweicloud.com,
	nphamcs@gmail.com,  baoquan.he@linux.dev, youngjun.park@lge.com,
	peterx@redhat.com, usama.arif@linux.dev,  willy@infradead.org,
	vbabka@kernel.org, surenb@google.com, mhocko@suse.com,
	 jackmanb@google.com, hannes@cmpxchg.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org,
	Qi Zheng <zhengqi.arch@bytedance.com>
Subject: Re: [RFC PATCH 0/8] Introducte Reserved THP
Date: Thu, 13 Aug 2026 11:45:34 +0100	[thread overview]
Message-ID: <an2ddJCknXARt3ej@lucifer> (raw)
In-Reply-To: <89837004-b5c9-4b59-b795-3b79005379af@kernel.org>

On Thu, Aug 13, 2026 at 12:00:30PM +0200, David Hildenbrand (Arm) wrote:
> ... digging through old mail.
>
> >
> > You mean the reservation should be done via some file handle, like
> > memfd, so that it is easy to apply memory policies to determine where
> > reserved memory locates?
> >
> > For existing hugetlb reservation, there is no fine control, like NUMA,
> > or cgroup, of the reserved free memory.
> >
> > Is that what you mean above?
>
> I guess, it's all tricky. hugetlb reservation is a mess. We better not make
> similar mistakes with THPs.
>
> [...]
>
> >>> 3.6 Remove Hugetlb
> >>> ------------------
> >>>
> >>> Once reserved THP can completely replace the existing functions of hugetlb, we
> >>> can gradually remove Hugetlb, leaving only one huge page management system in
> >>> the kernel.
> >>
> >> I'm sorry, but no way this will work in any reasonable timeframe unless you
> >> mimic the exact user facing ABI -- and I don't think we'll gain a lot that way.
> >>
> >> I know, we all like to dream, but this just isn't feasible.
> >
> > Based on my understanding, the key takeway is that we want to have more
> > control over reserved memory, where to get the free memory, who gets how
> > much of the reserved memory, and more.
>
> yes, it's all very complicated. Slapping on some MADV_RESERVED_THP is just
> entirely the wrong way to tackle this.

I agree with David that this series is a no-go, and there are many levels of
complexity here:

- What does reservation really mean in a context where any process can indicate
  desire for THP huge pages through MADV_HUGEPAGE or more big-hammer-ly
  MADV_COLLAPSE? Let alone mapping in THP-aligning file system's files or edge
  cases like DAX or soon, huge pfn mappings once I do that series.

- There's no sense of ownership, and as David says NUMA makes everything more
  complicated. And that's before we even get on to memcg.

- We have a flaming trashpile of a codebase that needs improving. There are
  (thankfully) efforts afoot on this front, but big new shiny features are as
  far as I am concerned on pause until technical debt is paid down _anyway_.

- We have a flaming trashpile of an API which we must keep intact despite it
  having many contradictions, edge cases and points of confusion.

I mean the list goes on.

Also it feels like reservation is almost throwing up our arms and giving up on
improving compaction which is part of the problem here - stalls have been seen
in real world use cases with even /sys/kernel/mm/transparent_hugepage/defrag set
to madvise let alone anything else - and I feel are part of why people want ways
around things.

I also think the idea of reserved memory flies in the face of THP on principle -
the 'T' stands for transparent :) but in general, as David says, hugetlb is a
horror show and a terrible maintenance headache (look at the recent hugetlb hw
poison stuff for an example of this), and mimicing anything it does is already a
dangerous road to take.

As usual we keep coming back to the same broader points:

- How to control the resource that is large folios in a sensible way that allows
  some semblence of control over this.

- Do we want to give more control or be more automatic? How do we achieve a
  balance and what metrics should we use?

- How do we even accurately measure all of this?

- and let's improve compaction/migration :)

These are all bikeshed-able, lead to endless discussions and I think are
fruitless at this stage - right now we have a mess, firstly let's improve that
mess and establish some foundations to build on iteratively.

I am really rather against big concept stuff in THP to be honest and more in
favour of small, incremental _improvements_ to what we already have.

And feature-wise, 1 GiB THP is on the horizon and as David says figuring that
out sensibly should be instructive.

But notice that Usama has been providing various foundational series (like the
huge swap stuff) to establish this.

So Tl;DR - let's be incremental, cautious, and improve this damn codebase before
we even think of larger changes.

>
> --
> Cheers,
>
> David

--
Cheers, Lorenzo

      reply	other threads:[~2026-08-13 10:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-27  7:21 [RFC PATCH 0/8] Introducte Reserved THP Qi Zheng
2026-06-27  7:21 ` [RFC PATCH 1/8] mm: page_alloc: add reserved THP pageblock type Qi Zheng
2026-06-27  7:21 ` [RFC PATCH 2/8] mm: add boot-time reserved THP pageblock capacity Qi Zheng
2026-06-27  7:21 ` [RFC PATCH 3/8] mm: page_alloc: add a reserved THP allocation primitive Qi Zheng
2026-06-27  7:21 ` [RFC PATCH 4/8] mm: add reserved THP quota helpers Qi Zheng
2026-06-27  7:21 ` [RFC PATCH 5/8] mm: add reserved THP vma flag Qi Zheng
2026-06-27  7:26 ` [RFC PATCH 6/8] mm: maintain reserved THP quota across VMA changes Qi Zheng
2026-06-27  7:26 ` [RFC PATCH 7/8] mm: support reserved THP VMAs in anonymous faults Qi Zheng
2026-06-27  7:26 ` [RFC PATCH 8/8] mm: add MADV_RESERVED_THP range policy Qi Zheng
2026-06-29  3:46 ` [RFC PATCH 0/8] Introducte Reserved THP Matthew Wilcox
2026-06-29 10:13   ` Qi Zheng
2026-06-29 12:20 ` David Hildenbrand (Arm)
2026-06-29 19:00   ` Gregory Price
2026-06-30 22:59   ` Barry Song
2026-06-30 23:34     ` Zi Yan
2026-07-01  0:24       ` Barry Song
2026-06-30 23:45   ` Zi Yan
2026-07-02  2:53     ` Qi Zheng
2026-08-13 10:00     ` David Hildenbrand (Arm)
2026-08-13 10:45       ` Lorenzo Stoakes (ARM) [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=an2ddJCknXARt3ej@lucifer \
    --to=ljs@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=baoquan.he@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=kasong@tencent.com \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=npache@redhat.com \
    --cc=nphamcs@gmail.com \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=qi.zheng@linux.dev \
    --cc=ryan.roberts@arm.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.org \
    --cc=youngjun.park@lge.com \
    --cc=zhengqi.arch@bytedance.com \
    --cc=ziy@nvidia.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