]> git.hungrycats.org Git - linux/commit
mm/hugetlb_cma: restrict hugetlb_cma parameter to gigantic-page alignment
authorSang-Heon Jeon <ekffu200098@gmail.com>
Sun, 3 May 2026 08:42:25 +0000 (17:42 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 2 Jun 2026 22:22:16 +0000 (15:22 -0700)
commitfb95c50921f0a65ef9fd734ae712e416db949d91
treebcb4115d0a70cdcba99b2507b19564c0bad8bf74
parent7d40e6b66d97d7feef8ca3c096827fd24c6d623d
mm/hugetlb_cma: restrict hugetlb_cma parameter to gigantic-page alignment

Existing hugetlb_cma parameter handling logic rejects sizes smaller than
one gigantic page, but rounds up larger sizes that are not a multiple of
it.  The two behaviors are inconsistent and neither is documented.

To remove existing inconsistent and undefined behavior, restrict
hugetlb_cma parameter to only accept multiples of the gigantic page size.

After this restriction, the redundant round_up() in the allocation loop
can be removed.

The new restriction is also documented in kernel-parameters.txt.

Also, including other minor changes for readability improvement with no
functional change.

Link: https://lore.kernel.org/20260503084225.415980-1-ekffu200098@gmail.com
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Suggested-by: Muchun Song <muchun.song@linux.dev>
Acked-by: Muchun Song <muchun.song@linux.dev>
Acked-by: Oscar Salvador <osalvador@suse.de>
Cc: David Hildenbrand <david@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Documentation/admin-guide/kernel-parameters.txt
mm/hugetlb_cma.c