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: enforce brace style

Documentation/process/coding-style.rst explicitly notes that if only one
branch of a conditional statement is a single statement, braces should be
used in both branches. Enforce this in mm/hugetlb.c.

While add it, fix the indentation for vma_end_reservation.

No functional change intended.

Link: https://lkml.kernel.org/r/20260116192717.1600049-2-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
824b8c96 a1c655f5

+13 -7
+13 -7
mm/hugetlb.c
··· 578 578 record_hugetlb_cgroup_uncharge_info(cg, h, map, nrg); 579 579 list_add(&nrg->link, rg); 580 580 coalesce_file_region(map, nrg); 581 - } else 581 + } else { 582 582 *regions_needed += 1; 583 + } 583 584 584 585 return to - from; 585 586 } ··· 1248 1247 1249 1248 if (vma_lock && vma_lock->vma != vma) 1250 1249 vma->vm_private_data = NULL; 1251 - } else 1250 + } else { 1252 1251 vma->vm_private_data = NULL; 1252 + } 1253 1253 } 1254 1254 1255 1255 /* ··· 2078 2076 h->max_huge_pages++; 2079 2077 goto out; 2080 2078 } 2081 - } else 2079 + } else { 2082 2080 rc = 0; 2081 + } 2083 2082 2084 2083 update_and_free_hugetlb_folio(h, folio, false); 2085 2084 return rc; ··· 2675 2672 * be consumed on a subsequent allocation. 2676 2673 */ 2677 2674 folio_set_hugetlb_restore_reserve(folio); 2678 - } else 2675 + } else { 2679 2676 /* 2680 2677 * No reservation present, do nothing 2681 2678 */ 2682 - vma_end_reservation(h, vma, address); 2679 + vma_end_reservation(h, vma, address); 2680 + } 2683 2681 } 2684 2682 } 2685 2683 ··· 4676 4672 if (vma_lock->vma != vma) { 4677 4673 vma->vm_private_data = NULL; 4678 4674 hugetlb_vma_lock_alloc(vma); 4679 - } else 4675 + } else { 4680 4676 pr_warn("HugeTLB: vma_lock already exists in %s.\n", __func__); 4681 - } else 4677 + } 4678 + } else { 4682 4679 hugetlb_vma_lock_alloc(vma); 4680 + } 4683 4681 } 4684 4682 } 4685 4683