Skip to content
Snippets Groups Projects
Commit 22a93f0d authored by Wang Wensheng's avatar Wang Wensheng Committed by Yang Yingliang
Browse files

numa/cdm: Introduce a hbm_per_part variable

ascend inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4D63I


CVE: NA

-------------------------------------------------

Not all cdm nodes are hbm and we don't need to operate on the other
nodes. So we should specify the hbm count per partion.

Here we assume that all the hbm nodes appear at first of all the cdm
nodes in one partion. Otherwise the management structure of the hbm
nodes could not be moved, which is not worse than closing this feature.

Signed-off-by: default avatarWang Wensheng <wangwensheng4@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent ca4172c8
No related branches found
No related tags found
No related merge requests found
......@@ -63,7 +63,9 @@ inline int arch_check_node_cdm(int nid)
* |node2 HBM| | |node4 HBM|
* |---------- | ----------|
* |node3 HBM| | |node5 HBM|
* ----------- | -----------
* |---------- | ----------|
* | ... | | | ... |
* |---------- | ----------|
*
* Return:
* This function returns a ddr node which is of the same partion with the input
......@@ -76,6 +78,12 @@ int __init cdm_node_to_ddr_node(int nid)
nodemask_t ddr_mask;
int nr_ddr, cdm_per_part, fake_nid;
int nr_cdm = nodes_weight(cdmmask);
/*
* Specify the count of hbm nodes whoes management structrue would be
* moved. Here number 2 is a magic and we should make it configable
* for extending
*/
int hbm_per_part = 2;
if (!nr_cdm || nodes_empty(numa_nodes_parsed))
return nid;
......@@ -87,11 +95,12 @@ int __init cdm_node_to_ddr_node(int nid)
nr_ddr = nodes_weight(ddr_mask);
cdm_per_part = nr_cdm / nr_ddr;
if (cdm_per_part == 0 || nid < nr_ddr)
if (cdm_per_part == 0 || nid < nr_ddr ||
nid >= (hbm_per_part + 1) * nr_ddr)
/* our assumption has borken, just return the original nid. */
return nid;
fake_nid = (nid - nr_ddr) / cdm_per_part;
fake_nid = (nid - nr_ddr) / hbm_per_part;
fake_nid = !node_isset(fake_nid, cdmmask) ? fake_nid : nid;
pr_info("nid: %d, fake_nid: %d\n", nid, fake_nid);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment