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

mm/hugetlb: align cma on allocation order, not demotion order

Align the CMA area for hugetlb gigantic pages to their size, not the size
that they can be demoted to. Otherwise there might be misaligned sections
at the start and end of the CMA area that will never be used for hugetlb
page allocations.

Link: https://lkml.kernel.org/r/20240430161437.2100295-1-fvdl@google.com
Fixes: a01f43901cfb ("hugetlb: be sure to free demoted CMA pages to CMA")
Signed-off-by: Frank van der Linden <fvdl@google.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Frank van der Linden and committed by
Andrew Morton
cc48be37 2acf0453

+1 -1
+1 -1
mm/hugetlb.c
··· 7800 7800 * huge page demotion. 7801 7801 */ 7802 7802 res = cma_declare_contiguous_nid(0, size, 0, 7803 - PAGE_SIZE << HUGETLB_PAGE_ORDER, 7803 + PAGE_SIZE << order, 7804 7804 HUGETLB_PAGE_ORDER, false, name, 7805 7805 &hugetlb_cma[nid], nid); 7806 7806 if (res) {