]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/hugetlb: remove unnecessary if condition
authorJoshua Hahn <joshua.hahnjy@gmail.com>
Fri, 16 Jan 2026 19:27:15 +0000 (14:27 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 31 Jan 2026 22:22:38 +0000 (14:22 -0800)
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>
mm/hugetlb.c

index 8c197307db0c4047639467e7bd02211d558a7568..a84869d33bed235c4ec675b7aec5c4bd688a7df0 100644 (file)
@@ -2989,13 +2989,10 @@ 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);
                }
        }