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: <a63c7a84-99d9-40c6-93cc-6c6fd46c4333@kernel.org>
Date: Thu, 15 Jan 2026 21:14:15 +0100
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
To: Joshua Hahn <joshua.hahnjy@...il.com>,
 Andrew Morton <akpm@...ux-foundation.org>
Cc: Muchun Song <muchun.song@...ux.dev>, Oscar Salvador <osalvador@...e.de>,
 linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 2/3] mm/hugetlb: Remove unnecessary if condition

On 1/15/26 19:14, Joshua Hahn wrote:
> if (map_chg) is always true, since it is nested in another if statement
> which checks for it already. Remove the check and un-indent for readability.
> 
> if (unlikely(map_chg == MAP_CHG_NEEDED && retval == 0)) {
> 	...
> 
> 	if (map_chg) {
> 		...
> 	}
> }
> 
> No functional change intended.
> 
> Signed-off-by: Joshua Hahn <joshua.hahnjy@...il.com>
> ---
>   mm/hugetlb.c | 12 +++++-------
>   1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 88b9e997c9da..432a5054ca1d 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -3019,13 +3019,11 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,
>   
>   			rsv_adjust = hugepage_subpool_put_pages(spool, 1);
>   			hugetlb_acct_memory(h, -rsv_adjust);
> -			if (map_chg) {
> -				spin_lock_irq(&hugetlb_lock);
> -				hugetlb_cgroup_uncharge_folio_rsvd(
> -				    hstate_index(h), pages_per_huge_page(h),
> -				    folio);
> -				spin_unlock_irq(&hugetlb_lock);
> -			}
> +			spin_lock_irq(&hugetlb_lock);
> +			hugetlb_cgroup_uncharge_folio_rsvd(
> +			    hstate_index(h), pages_per_huge_page(h),
> +			    folio);
> +			spin_unlock_irq(&hugetlb_lock);
>   		}
>   	}
>   

MAP_CHG_NEEDED = 1

Acked-by: David Hildenbrand (Red Hat) <david@...nel.org>

-- 
Cheers

David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ