The patch titled Subject: mm/hugetlb: ensure adequate CMA areas available for hugetlb_cma[] has been added to the -mm mm-unstable branch. Its filename is mm-hugetlb-ensure-adequate-cma-areas-available-for-hugetlb_cma.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb-ensure-adequate-cma-areas-available-for-hugetlb_cma.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Anshuman Khandual <anshuman.khandual@xxxxxxx> Subject: mm/hugetlb: ensure adequate CMA areas available for hugetlb_cma[] Date: Thu, 15 Feb 2024 10:04:05 +0530 HugeTLB CMA area array is being created for possible MAX_NUMNODES without ensuring corresponding MAX_CMA_AREAS support in CMA. This fails the build for such scenarios indicating need for CONFIG_CMA_AREAS adjustment. Link: https://lkml.kernel.org/r/20240215043405.2379295-1-anshuman.khandual@xxxxxxx Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx> Cc: Muchun Song <muchun.song@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/mm/hugetlb.c~mm-hugetlb-ensure-adequate-cma-areas-available-for-hugetlb_cma +++ a/mm/hugetlb.c @@ -7855,6 +7855,13 @@ void __init hugetlb_cma_reserve(int orde } reserved = 0; + + /* + * There needs to be enough MAX_CMA_AREAS to accommodate + * MAX_NUMNODES heap areas being created here. Otherwise + * adjust CONFIG_CMA_AREAS as required. + */ + BUILD_BUG_ON(MAX_CMA_AREAS < MAX_NUMNODES); for_each_online_node(nid) { int res; char name[CMA_MAX_NAME]; _ Patches currently in -mm which might be from anshuman.khandual@xxxxxxx are mm-memblock-add-memblock_rsrv_noinit-into-flagname-array.patch mm-cma-dont-treat-bad-input-arguments-for-cma_alloc-as-its-failure.patch mm-cma-drop-config_cma_debug.patch mm-cma-make-max_cma_areas-=-config_cma_areas.patch mm-cma-add-sysfs-file-release_pages_success.patch mm-hugetlb-move-page-order-check-inside-hugetlb_cma_reserve.patch mm-hugetlb-ensure-adequate-cma-areas-available-for-hugetlb_cma.patch