mm-hugetlb-pass-correct-order_per_bit-to-cma_declare_contiguous_nid.patch removed from -mm tree
The quilt patch titled
Subject: mm/hugetlb: pass correct order_per_bit to cma_declare_contiguous_nid
has been removed from the -mm tree. Its filename was
mm-hugetlb-pass-correct-order_per_bit-to-cma_declare_contiguous_nid.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Frank van der Linden <[email protected]>
Subject: mm/hugetlb: pass correct order_per_bit to cma_declare_contiguous_nid
Date: Thu, 4 Apr 2024 16:25:15 +0000
The hugetlb_cma code passes 0 in the order_per_bit argument to cma_declare_contiguous_nid (the alignment, computed using the page order, is correctly passed in).
This causes a bit in the cma allocation bitmap to always represent a 4k page, making the bitmaps potentially very large, and slower.
It would create bitmaps that would be pretty big. E.g. for a 4k page size on x86, hugetlb_cma=64G would mean a bitmap size of (64G / 4k) / 8 == 2M. With HUGETLB_PAGE_ORDER as order_per_bit, as intended, this would be (64G / 2M) / 8 == 4k. So, that's quite a difference.
Also, this restricted the hugetlb_cma area to ((PAGE_SIZE << MAX_PAGE_ORDER) * 8) * PAGE_SIZE (e.g. 128G on x86) , since bitmap_alloc uses normal page allocation, and is thus restricted by MAX_PAGE_ORDER. Specifying anything about that would fail the CMA initialization.
So, correctly pass in the order instead.
---
mm/hugetlb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/hugetlb.c renamed from mm/hugetlb.c~mm-hugetlb-pass-correct-order_per_bit-to-cma_declare_contiguous_nid +3 -3
@@ -7794,9 +7794,9 @@ void __init hugetlb_cma_reserve(int orde* huge page demotion. */ res =cma_declare_contiguous_nid (0 , size,0 , -PAGE_SIZE <<HUGETLB_PAGE_ORDER , -0 , false, name, - &hugetlb_cma[nid], nid); +PAGE_SIZE <<HUGETLB_PAGE_ORDER , +HUGETLB_PAGE_ORDER , false, name, + &hugetlb_cma[nid], nid);if (res) {pr_warn ("hugetlb_cma: reservation failed: err %d, node %d" , res, nid);
_
Patches currently in -mm which might be from [email protected] are