public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Muhammad Usama Anjum <usama.anjum@arm.com>,
	Lorenzo Stoakes <ljs@kernel.org>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@kernel.org>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Brendan Jackman <jackmanb@google.com>, Zi Yan <ziy@nvidia.com>,
	Uladzislau Rezki <urezki@gmail.com>,
	Nick Terrell <terrelln@fb.com>, David Sterba <dsterba@suse.com>,
	Vishal Moola <vishal.moola@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org, david.hildenbrand@arm.com
Subject: Re: [PATCH v6 0/3] mm: Free contiguous order-0 pages efficiently
Date: Thu, 30 Apr 2026 08:09:50 -0400	[thread overview]
Message-ID: <20260430120950.GA1738@cmpxchg.org> (raw)
In-Reply-To: <4ff3d230-d48d-4a9c-aac8-30a7b80c4775@kernel.org>

On Wed, Apr 29, 2026 at 03:04:16PM +0200, David Hildenbrand (Arm) wrote:
> On 4/29/26 14:31, Ryan Roberts wrote:
> > On 29/04/2026 13:04, Andrew Morton wrote:
> >> On Wed, 29 Apr 2026 06:33:26 -0400 Johannes Weiner <hannes@cmpxchg.org> wrote:
> >>
> >>>
> >>> I think we should revert the original patch.
> >>>
> >>> The premise is that we can save some allocator calls by requesting
> >>> higher orders and splitting them up into singles. This is a frivolous
> >>> and short-sighted use of a very coveted and expensive resource.
> > 
> > I'm not sure it's that simple. First off, vmalloc has preferred to allocate high
> > order pages for quite a while, it's just that the patch you're referring to
> > makes it try even harder. So reverting the patch doesn't completely revert the
> > behaviour, it just reduces it.
> > 
> > Performance benefits because those high order pages are mapped appropriately in
> > the page table - i.e. 1G PUD, 2M PMD, (or 64K CONTPTE on arm64). So it's not
> > solely about the number of cycles spent in the allocator; the HW is used more
> > efficiently. vmalloc only splits to order-0 for the benefit of the caller,
> > because there are some places that assume they can access each returned struct page.
> > 
> > And all the order-0 pages of the original high order page are freed at the same
> > time, so it's not like we are destroying the contiguous resource; it remains
> > intact for the next user (well, ignoring that some will be freed to the pcpu
> > list - this series solves that wrinkle). I've heard it argued that this approach
> > is actually _better_ for conserving contiguous blocks because it's keeping the
> > lifetime of all the constituent pages bound together and reducing fragmentation.
> > I've never seen any data though...
> 
> Right, that's what Willy has said: allocating+freeing larger blocks, especially
> for unmovable data, reduces fragmentation as a whole. And that theory makes
> sense for me in the context here.

Do we have data confirming that it works out like that?

I think the missing piece is that as long as we still *do* have small
order requests with mixed lifetimes, they will punch holes and cause
fragmentation. Large requests need to clean them up, which is
expensive. You can of course make the argument that it's really the
small requests that are the source of the cost. And I would agree ;)

But adding higher order requests right now surfaces that cost. We've
seen that everytime in real workloads: THP, the large page cache
requests, and now vmalloc. They all increase compaction rates, cause
failures in higher-order network atomics etc.

I do appreciate it's a chicken and egg problem. But I don't think we
can justify regressions from now until there are no more small(er),
fragmenting requests.

So we should still require some form of amortization story when we add
larger requests. It's not accurate to say that they pay for themselves
right now.

And the small cost reduction in the vmalloc alloc path does not offset
the externalities of consuming contiguity, not by a long shot.

  reply	other threads:[~2026-04-30 12:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 10:16 [PATCH v6 0/3] mm: Free contiguous order-0 pages efficiently Muhammad Usama Anjum
2026-04-01 10:16 ` [PATCH v6 1/3] mm/page_alloc: Optimize free_contig_range() Muhammad Usama Anjum
2026-04-01 10:16 ` [PATCH v6 2/3] vmalloc: Optimize vfree with free_pages_bulk() Muhammad Usama Anjum
2026-04-01 10:19   ` David Hildenbrand (Arm)
2026-04-01 15:13   ` Uladzislau Rezki
2026-04-01 10:16 ` [PATCH v6 3/3] mm/page_alloc: Optimize __free_contig_frozen_range() Muhammad Usama Anjum
2026-04-22 13:42 ` [PATCH v6 0/3] mm: Free contiguous order-0 pages efficiently Ryan Roberts
2026-04-22 15:40   ` David Hildenbrand (Arm)
2026-04-29 10:33 ` Johannes Weiner
2026-04-29 12:04   ` Andrew Morton
2026-04-29 12:31     ` Ryan Roberts
2026-04-29 13:04       ` David Hildenbrand (Arm)
2026-04-30 12:09         ` Johannes Weiner [this message]
2026-04-29 13:52       ` Johannes Weiner
2026-04-30 12:32         ` Ryan Roberts

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=20260430120950.GA1738@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=bpf@vger.kernel.org \
    --cc=david.hildenbrand@arm.com \
    --cc=david@kernel.org \
    --cc=dsterba@suse.com \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=surenb@google.com \
    --cc=terrelln@fb.com \
    --cc=urezki@gmail.com \
    --cc=usama.anjum@arm.com \
    --cc=vbabka@kernel.org \
    --cc=vishal.moola@gmail.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