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: <def56e60-42ae-4848-b0a0-91bd1c95d8d7@redhat.com>
Date: Mon, 13 Oct 2025 10:10:05 +0200
From: David Hildenbrand <david@...hat.com>
To: Gregory Price <gourry@...rry.net>, linux-mm@...ck.org
Cc: 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 08.10.25 23:26, Gregory Price wrote:
> Simplify if-true-return-true-else-false logic.
> 
> Signed-off-by: Gregory Price <gourry@...rry.net>
> ---
>   include/linux/hugetlb.h | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> 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:
	return true;
default:
	return false;
}

-- 
Cheers

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ