From 9f7b1a93150c6bb1f54a7bf5ce36b344f10cdf4a Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Wed, 20 Feb 2019 12:03:16 -0500 Subject: [PATCH] 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 --- cputree.c | 22 +++++++++++++++++++--- placement.c | 9 +++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/cputree.c b/cputree.c index f08ce84..5551784 100644 --- a/cputree.c +++ b/cputree.c @@ -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; diff --git a/placement.c b/placement.c index 5a82111..efa8c57 100644 --- a/placement.c +++ b/placement.c @@ -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; }