Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/hugetlb: remove unnecessary if condition

if (map_chg) is always true, since it is nested in another if statement
which checks for map_chg == MAP_CHG_NEEDED, which is equal to 1.

if (unlikely(map_chg == MAP_CHG_NEEDED && retval == 0)) {
...

if (map_chg) {
...
}
}

Remove the check, un-indent, and collapse the function call for
readability.

No functional change intended.

Link: https://lkml.kernel.org/r/20260116192717.1600049-1-joshua.hahnjy@gmail.com
Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Reviewed-by: SeongJae Park <sj@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Joshua Hahn and committed by
Andrew Morton
a1c655f5 94350fe6

+4 -7
+4 -7
mm/hugetlb.c
··· 2989 2989 2990 2990 rsv_adjust = hugepage_subpool_put_pages(spool, 1); 2991 2991 hugetlb_acct_memory(h, -rsv_adjust); 2992 - if (map_chg) { 2993 - spin_lock_irq(&hugetlb_lock); 2994 - hugetlb_cgroup_uncharge_folio_rsvd( 2995 - hstate_index(h), pages_per_huge_page(h), 2996 - folio); 2997 - spin_unlock_irq(&hugetlb_lock); 2998 - } 2992 + spin_lock_irq(&hugetlb_lock); 2993 + hugetlb_cgroup_uncharge_folio_rsvd( 2994 + hstate_index(h), pages_per_huge_page(h), folio); 2995 + spin_unlock_irq(&hugetlb_lock); 2999 2996 } 3000 2997 } 3001 2998