lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <36001B4C-A781-4571-AE65-4C00C9D215FC@nvidia.com>
Date: Tue, 06 Jan 2026 13:56:03 -0500
From: Zi Yan <ziy@...dia.com>
To: "David Hildenbrand (Red Hat)" <david@...nel.org>
Cc: Gregory Price <gourry@...rry.net>, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org, kernel-team@...a.com,
 akpm@...ux-foundation.org, vbabka@...e.cz, surenb@...gle.com,
 mhocko@...e.com, jackmanb@...gle.com, hannes@...xchg.org,
 richard.weiyang@...il.com
Subject: Re: [PATCH v7] page_alloc: allow migration of smaller hugepages
 during contig_alloc

On 6 Jan 2026, at 13:46, David Hildenbrand (Red Hat) wrote:

>> -			return false;
>> +		/*
>> +		 * Only consider ranges containing hugepages if those pages are
>> +		 * smaller than the requested contiguous region.  e.g.:
>> +		 *     Move 2MB pages to free up a 1GB range.
>> +		 *     Don't move 1GB pages to free up a 2MB range.
>> +		 *
>> +		 * This makes contiguous allocation more reliable if multiple
>> +		 * hugepage sizes are used without causing needless movement.
>> +		 */
>> +		if (PageHuge(page)) {
>> +			unsigned int order;
>> +
>> +			if (!IS_ENABLED(CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION))
>> +				return false;
>> +
>> +			if (skip_hugetlb) {
>> +				*skipped_hugetlb = true;
>> +				return false;
>> +			}
>> +
>> +			page = compound_head(page);
>> +			order = compound_order(page);
>> +			if ((order >= MAX_FOLIO_ORDER) ||
>> +			    (nr_pages <= (1 << order)))
>> +				return false;
>> +
>> +			/*
>> +			 * Reaching this point means we've encounted a huge page
>> +			 * smaller than nr_pages, skip all pfn's for that page.
>> +			 *
>> +			 * We can't get here from a tail-PageHuge, as it implies
>> +			 * we started a scan in the middle of a hugepage larger
>> +			 * than nr_pages - which the prior check filters for.
>> +			 */
>> +			i += (1 << order) - 1;
>
> Assuming page != compound_head(page), you'd be skipping too much.

It might not happen based on my reasoning[1], but feel free to punch poles. :)

[1] https://lore.kernel.org/all/7EED2D83-AE17-49CB-BDB6-954793EAFDBF@nvidia.com/

>
> You'd only have to skip as many pages as pages are left in this compound page.
>
> I think we have similar code elsewhere: see has_unmovable_pages().
>
> Apart from that LGTM.


Best Regards,
Yan, Zi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ