[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aPZkzY6cGfdKo8K8@gourry-fedora-PF4VCD3F>
Date: Mon, 20 Oct 2025 12:35:25 -0400
From: Gregory Price <gourry@...rry.net>
To: David Hildenbrand <david@...hat.com>
Cc: linux-mm@...ck.org, osalvador@...e.de, corbet@....net,
muchun.song@...ux.dev, akpm@...ux-foundation.org,
hannes@...xchg.org, laoar.shao@...il.com, mclapinski@...gle.com,
joel.granados@...nel.org, jack@...e.cz, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, Mel Gorman <mgorman@...e.de>,
Michal Hocko <mhocko@...e.com>,
Alexandru Moise <00moses.alexander00@...il.com>,
David Rientjes <rientjes@...gle.com>
Subject: Re: [RFC PATCH] mm, hugetlb: implement movable_gigantic_pages sysctl
On Mon, Oct 20, 2025 at 12:05:41PM -0400, Gregory Price wrote:
> On Mon, Oct 20, 2025 at 04:17:06PM +0200, David Hildenbrand wrote:
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 5549b32cdd31..5def2c53092e 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6922,8 +6922,12 @@ static bool pfn_range_valid_contig(struct zone *z, unsigned long start_pfn,
> if (PageReserved(page))
> return false;
>
> - if (PageHuge(page))
> - return false;
> + if (PageHuge(page)) {
> + /* Don't consider moving same size/larger pages */
> + if (!CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION ||
> + ((1 << compound_order(page)) >= nr_pages))
> + return false;
> + }
> }
> return true;
> }
Quick spot-check of the compaction code suggests this is handled
essentially the same way - and in fact compaction expects
alloc_contig to be sending compaction requests w/ hugepages.
So I'll go ahead and submit this separately for discussion.
~Gregory
---
->isolate_migratepages_range()
->isolate_migratepages_block()
{
...
if (PageHuge(page)) {
const unsigned int order = compound_order(page);
/*
* skip hugetlbfs if we are not compacting for pages
* bigger than its order. THPs and other compound pages
* are handled below.
*/
...
/* for alloc_contig case */
if (locked) {
unlock_page_lruvec_irqrestore(locked, flags);
locked = NULL;
}
}
...
/*
* Regardless of being on LRU, compound pages such as THP
* (hugetlbfs is handled above) are not to be compacted unless
* we are attempting an allocation larger than the compound
* page size. We can potentially save a lot of iterations if we
* skip them at once. The check is racy, but we can consider
* only valid values and the only danger is skipping too much.
*/
if (PageCompound(page) && !cc->alloc_contig) {
const unsigned int order = compound_order(page);
/* Skip based on page order and compaction target order. */
if (skip_isolation_on_order(order, cc->order)) {
if (order <= MAX_PAGE_ORDER) {
low_pfn += (1UL << order) - 1;
nr_scanned += (1UL << order) - 1;
}
goto isolate_fail;
}
}
}
Powered by blists - more mailing lists