[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aO-Wxj7al7I-IadV@casper.infradead.org>
Date: Wed, 15 Oct 2025 13:42:46 +0100
From: Matthew Wilcox <willy@...radead.org>
To: "Vishal Moola (Oracle)" <vishal.moola@...il.com>
Cc: Uladzislau Rezki <urezki@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC PATCH] mm/vmalloc: request large order pages from buddy
allocator
On Wed, Oct 15, 2025 at 03:44:22AM -0700, Vishal Moola (Oracle) wrote:
> On Wed, Oct 15, 2025 at 10:23:19AM +0200, Uladzislau Rezki wrote:
> > > int i;
> > > + gfp_t large_gfp = (gfp & ~__GFP_DIRECT_RECLAIM) | __GFP_NOWARN;
> > > + unsigned int large_order = ilog2(nr_pages - nr_allocated);
> > >
> > If large_order is > MAX_ORDER - 1 then there is no need even try
> > larger_order attempt.
Oh, I meant to mention that too. Yes, this should be min(MAX_ORDER, ilog2()).
> > Maybe it is worth to drop/warn if __GFP_COMP is set also?
>
> split_page() has a BUG_ON(PageCompound) within, so we don't need one out
> here for now.
I don't think people actually call vmalloc() with __GFP_COMP set, but
clearing it would do no harm here.
> > The concern is then if it is a waste of high-order pages. Because we can
> > easily go with a single page allocator. Whereas someone in a system can not.
>
> I feel like if we have high order pages available we'd rather allocate
> those. Since the buddy allocator just coalesces the pages when they're
> freed again, as soon as these allocations free up we are much more
> likely to have large order pages ready to go again.
My PoV is different from either of you -- that we actually want
to allocate the high-order pages when we can because it reduces
fragmentation. If we allocate five separate pages to satisfy a 20kB
allocation, those may come from five different 2MB pages (since they're
probably coming from the pcp lists which after a sufficiently long period
of running will be a jumble). Whereas if we allocate an order-2 page
and an order-0 page, those can come from at most two 2MB pages.
I understand the "allocating order-0 pages helps by using up the remnants
of previous allocations" argument. But I think on the whole we need to
be doing larger allocations where possible, not smaller ones.
Powered by blists - more mailing lists