remove power9 hack and add more generic way to detect numa
This commit is contained in:
parent
a20efc795d
commit
d1c51ffc66
15
topo.c
15
topo.c
@ -35,6 +35,7 @@ struct topo_obj {
|
||||
int cache_level;
|
||||
cpuset_t mask;
|
||||
int flags;
|
||||
int level;
|
||||
int num_children;
|
||||
struct topo_obj * parent;
|
||||
struct topo_obj * children[TOPO_MAX_CHILDREN];
|
||||
@ -170,6 +171,7 @@ tobj_populate_root(xmlNode * root, struct topo_obj * parent, struct topo_obj **
|
||||
struct topo_obj * tobj = malloc(sizeof(struct topo_obj));
|
||||
tobj->cache_level = cache_level;
|
||||
tobj->num_children = 0;
|
||||
tobj->level = level;
|
||||
tobj->parent = parent;
|
||||
tobj->flags = TOPO_FLAG_NONE;
|
||||
CPU_ZERO(&tobj->mask);
|
||||
@ -324,17 +326,10 @@ tobj_core_to_numa(struct topo_obj * root, int coreid)
|
||||
}
|
||||
|
||||
while(obj->parent != NULL) {
|
||||
obj = obj->parent;
|
||||
if (obj->flags & TOPO_FLAG_NUMA) {
|
||||
if (obj->parent != NULL) {
|
||||
for (int i = 0; i < obj->parent->num_children; i++) {
|
||||
if (obj->parent->children[i] == obj) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
if (obj->level == 1) {
|
||||
return obj->num_children;
|
||||
}
|
||||
obj = obj->parent;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user