From: Wang Wensheng wangwensheng4@huawei.com
The existing cdm-nodes parameter supports 64 nodes at most and we could not set a node whose id exceed 64 to cdm node. Extend this to accept a series of long integer sepeated by comma.
Signed-off-by: Wang Wensheng wangwensheng4@huawei.com Signed-off-by: Zhang Zekun zhangzekun11@huawei.com Reviewed-by: Weilong Chen chenweilong@huawei.com --- .../admin-guide/kernel-parameters.txt | 1 + arch/arm64/mm/numa.c | 39 ++++++++++++++----- 2 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 8a1a25216da6..719177c3c456 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -498,6 +498,7 @@ One bit express one node, if the node is HBM, set the bit to 1. Then transform Binary to hexadecimal. Example: node1, node2 is HBM, cdm-nodes=0x06. + Example: node1,node64,node65,node66 is HBM cdm-nodes=0x2,0x7
cgroup_disable= [KNL] Disable a particular controller Format: {name of the controller(s) to disable} diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index 480fcfb1b917..8ce99c6c593e 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -179,20 +179,41 @@ int __init cdm_node_to_ddr_node(int nid) } #endif
+/* + * Example: node1,node64,node65,node66 is HBM cdm-nodes=0x2,0x7 + * Note that the first long integer indicate the cdm-nodes of nodeid 0-63, the + * second of 64-127... + */ static int __init cdm_nodes_setup(char *s) { - int nid; + char *n; unsigned long tmpmask; - int err; + int nid, err, base = 0;
- err = kstrtoul(s, 0, &tmpmask); - if (err) - return err; + do { + n = strchr(s, ','); + if (n) + *n = '\0'; + + err = kstrtoul(s, 0, &tmpmask); + if (err) + return err; + + for (nid = 0; nid < BITS_PER_LONG; nid++) { + if (nid + base >= MAX_NUMNODES) + return 0; + + if ((tmpmask >> nid) & 1) + node_set(nid + base, cdmmask); + } + + if (!n) + break; + + s = n + 1; + base += BITS_PER_LONG; + } while (1);
- for (nid = 0; nid < MAX_NUMNODES; nid++) { - if ((tmpmask >> nid) & 1) - node_set(nid, cdmmask); - } return 0; } early_param("cdm-nodes", cdm_nodes_setup);