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] [day] [month] [year] [list]
Message-ID: <c3175394-7fc3-43fd-9fad-4d3790837e3e@redhat.com>
Date: Mon, 20 Oct 2025 20:15:06 +0200
From: David Hildenbrand <david@...hat.com>
To: Gregory Price <gourry@...rry.net>
Cc: linux-mm@...ck.org, muchun.song@...ux.dev, osalvador@...e.de,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] hugetlb.h: flatten logic in
 arch_hugetlb_migration_supported

On 20.10.25 18:14, Gregory Price wrote:
> On Mon, Oct 13, 2025 at 10:10:05AM +0200, David Hildenbrand wrote:
>> On 08.10.25 23:26, Gregory Price wrote:
>>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>>> index 526d27e88b3b..b030850975ef 100644
>>> --- a/include/linux/hugetlb.h
>>> +++ b/include/linux/hugetlb.h
>>> @@ -876,12 +876,9 @@ static inline void folio_clear_hugetlb_hwpoison(struct folio *folio)
>>>    #ifndef arch_hugetlb_migration_supported
>>>    static inline bool arch_hugetlb_migration_supported(struct hstate *h)
>>>    {
>>> -	if ((huge_page_shift(h) == PMD_SHIFT) ||
>>> +	return ((huge_page_shift(h) == PMD_SHIFT) ||
>>>    		(huge_page_shift(h) == PUD_SHIFT) ||
>>> -			(huge_page_shift(h) == PGDIR_SHIFT))
>>> -		return true;
>>> -	else
>>> -		return false;
>>> +		(huge_page_shift(h) == PGDIR_SHIFT));
>>
>> switch (huge_page_shift(h)) {
>> case PMD_SHIFT:
>> case PUD_SHIFT:
>> case PGDIR_SHIFT:
> 
> PGDIR_SHIFT is not a constant on x86.

Ah, probably because of 4 vs. 5 level page tables. On x86 the check 
doesn't even make any sense as we don't support PGD-sized pages.

If we could rule that out at compile time, it would be nice. But I don't 
think we have a way to test that support at compile time.

But anyhow, nothing against what we have in this patch here

Acked-by: David Hildenbrand <david@...hat.com>

-- 
Cheers

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ