Re: [PATCH v3] hugetlb: Support node specified when using cma for gigantic hugepages

From: Mike Kravetz
Date: Fri Oct 15 2021 - 18:22:27 EST


On 10/14/21 7:03 PM, Baolin Wang wrote:
> Now the size of CMA area for gigantic hugepages runtime allocation is
> balanced for all online nodes, but we also want to specify the size of
> CMA per-node, or only one node in some cases, which are similar with
> patch [1].
>
> For example, on some multi-nodes systems, each node's memory can be
> different, allocating the same size of CMA for each node is not suitable
> for the low-memory nodes. Meanwhile some workloads like DPDK mentioned by
> Zhenguo in patch [1] only need hugepages in one node.
>
> On the other hand, we have some machines with multiple types of memory,
> like DRAM and PMEM (persistent memory). On this system, we may want to
> specify all the hugepages only on DRAM node, or specify the proportion
> of DRAM node and PMEM node, to tuning the performance of the workloads.
>
> Thus this patch adds node format for 'hugetlb_cma' parameter to support
> specifying the size of CMA per-node. An example is as follows:
>
> hugetlb_cma=0:5G,2:5G
>
> which means allocating 5G size of CMA area on node 0 and node 2
> respectively. And the users should use the node specific sysfs file to
> allocate the gigantic hugepages if specified the CMA size on that node.
>
> [1]
> https://lkml.kernel.org/r/20211005054729.86457-1-yaozhenguo1@xxxxxxxxx
>
> Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>

Thanks for all of your updates. This version looks good to me.

Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>

> ---
> Changes from v2:
> - Update the commit log.
> - Remove hugetlb_cma_nodes_allowed nodemask and related code.
> - Rebase on the current linux-next branch.
>
> Changes from v1:
> - Update the commit log.
> - Avoid changing the behavior for 'balanced' gigantic huge page pool
> allocations.
> - Catch the invalid node specified in hugetlb_cma_reserve().
> - Validate the size of CMA for each node in hugetlb_cma_reserve().
> ---
> Documentation/admin-guide/kernel-parameters.txt | 6 +-
> mm/hugetlb.c | 86 ++++++++++++++++++++++---
> 2 files changed, 81 insertions(+), 11 deletions(-)

--
Mike Kravetz