hugetlb: Support node specified when using cma for gigantic hugepages
Subsystems (3)
PATCH v3 1/1 hugetlb: Support node specified when using cma for gigantic hugepages
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/[email protected]
---
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(-)
Documentation/admin-guide/kernel-parameters.txt +4 -2
@@ -1587,8 +1587,10 @@ registers. Default set by CONFIG_HPET_MMAP_DEFAULT. hugetlb_cma= [HW,CMA] The size of a CMA area used for allocation - of gigantic hugepages. - Format: nn[KMGTPE] + of gigantic hugepages. Or using node format, the size + of a CMA area per node can be specified. + Format: nn[KMGTPE] or (node format) + <node>:nn[KMGTPE][,<node>:nn[KMGTPE]] Reserve a CMA area of given size and allocate gigantic hugepages using the CMA allocator. If enabled, the
mm/hugetlb.c +77 -9
122 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 20 lines · Baolin Wang
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
Quoted 8 lines
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/[email protected]Signed-off-by Baolin Wang <[email protected]>
Thanks for all of your updates. This version looks good to me.
Quoted 16 lines
---
Changes from v2:
- Update the commit log.
- Removehugetlb_cma_nodes_allowednodemask 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 inhugetlb_cma_reserve().
- Validate the size of CMA for each node inhugetlb_cma_reserve().--- Documentation/admin-guide/kernel-parameters.txt | 6 +- mm/hugetlb.c | 86 ++++++++++++++++++++++--- 2 files changed, 81 insertions(+), 11 deletions(-)
Signature · 1 line
Mike Kravetz