[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251121113138.9955cb18d9b6c7ce812d5c0a@linux-foundation.org>
Date: Fri, 21 Nov 2025 11:31:38 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Gregory Price <gourry@...rry.net>
Cc: linux-mm@...ck.org, kernel-team@...a.com, vbabka@...e.cz,
surenb@...gle.com, mhocko@...e.com, jackmanb@...gle.com,
hannes@...xchg.org, ziy@...dia.com, linux-kernel@...r.kernel.org, David
Hildenbrand <david@...hat.com>, Wei Yang <richard.weiyang@...il.com>, Oscar
Salvador <osalvador@...e.de>, David Rientjes <rientjes@...gle.com>
Subject: Re: [PATCH v3] page_alloc: allow migration of smaller hugepages
during contig_alloc
On Fri, 21 Nov 2025 14:15:40 -0500 Gregory Price <gourry@...rry.net> wrote:
> We presently skip regions with hugepages entirely when trying to do
> contiguous page allocation. Instead, if hugepage migration is enabled,
> consider regions with hugepages smaller than the target contiguous
> allocation request as valid targets for allocation.
Why? What benefit does this have to our users?
Some runtime testing results might be helpful?
> isolate_migrate_pages_block() already expects requests with hugepages
> to originate from alloc_contig, and hugetlb code also does a migratable
> check when isolating in folio_isolate_hugetlb().
>
> Suggested-by: David Hildenbrand <david@...hat.com>
A Link: here might be illuminating.
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6849,8 +6849,19 @@ 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)) {
> + unsigned int order;
> +
> + if (!IS_ENABLED(CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION))
> + return false;
> +
> + /* Don't consider moving same size/larger pages */
Comment says "what" (which was fairly obvious). Please reveal "why".
> + page = compound_head(page);
> + order = compound_order(page);
> + if ((order >= MAX_FOLIO_ORDER) ||
> + (nr_pages <= (1 << order)))
> + return false;
> + }
> }
> return true;
> }
Powered by blists - more mailing lists