fix balancing when numa information isn't available

Discovered a bug in which, when numa isn't available we failed to assign
the unspecified node to the device tree, leading us to not balance any
interrupts.  Make sure it gets added so irq get parsed down through the
tree to the proper topology node

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
Neil Horman 2019-02-20 12:03:16 -05:00 committed by nhorman
parent f5ca2eb481
commit 9f7b1a9315
2 changed files with 24 additions and 7 deletions

View file

@ -126,9 +126,10 @@ static void add_numa_node_to_topo_obj(struct topo_obj *obj, int nodeid)
GList *entry;
struct topo_obj *node;
struct topo_obj *cand_node;
struct topo_obj *package;
node = get_numa_node(nodeid);
if (!node || node->number == -1)
if (!node || (numa_avail && (node->number == -1)))
return;
entry = g_list_first(obj->numa_nodes);
@ -141,6 +142,21 @@ static void add_numa_node_to_topo_obj(struct topo_obj *obj, int nodeid)
if (!entry)
obj->numa_nodes = g_list_append(obj->numa_nodes, node);
if (!numa_avail && obj->obj_type == OBJ_TYPE_PACKAGE) {
entry = g_list_first(node->children);
while (entry) {
package = entry->data;
if (package == obj)
break;
entry = g_list_next(entry);
}
if (!entry) {
node->children = g_list_append(node->children, obj);
obj->parent = node;
}
}
}
static struct topo_obj* add_cache_domain_to_package(struct topo_obj *cache,
@ -189,7 +205,7 @@ static struct topo_obj* add_cache_domain_to_package(struct topo_obj *cache,
cache->parent = package;
}
if (nodeid > -1)
if (!numa_avail || (nodeid > -1))
add_numa_node_to_topo_obj(package, nodeid);
return package;
@ -236,7 +252,7 @@ static struct topo_obj* add_cpu_to_cache_domain(struct topo_obj *cpu,
cpu->parent = (struct topo_obj *)cache;
}
if (nodeid > -1)
if (!numa_avail || (nodeid > -1))
add_numa_node_to_topo_obj(cache, nodeid);
return cache;

View file

@ -130,7 +130,7 @@ static void place_irq_in_node(struct irq_info *info, void *data __attribute__((u
if ((info->level == BALANCE_NONE) && cpus_empty(banned_cpus))
return;
if (irq_numa_node(info)->number != -1) {
if (irq_numa_node(info)->number != -1 || !numa_avail) {
/*
* Need to make sure this node is elligible for migration
* given the banned cpu list
@ -138,12 +138,13 @@ static void place_irq_in_node(struct irq_info *info, void *data __attribute__((u
if (!cpus_intersects(irq_numa_node(info)->mask, unbanned_cpus))
goto find_placement;
/*
* This irq belongs to a device with a preferred numa node
* put it on that node
*/
* This irq belongs to a device with a preferred numa node
* put it on that node
*/
migrate_irq(&rebalance_irq_list, &irq_numa_node(info)->interrupts, info);
info->assigned_obj = irq_numa_node(info);
irq_numa_node(info)->load += info->load + 1;
return;
}