Instead of silently assigning CPU to node 0 when it is omitted from the
command-line, check if all CPUs up to max_cpus are present in the NUMA
configuration.

I am making this a warning and not a fatal error, to allow management
software to be updated if necessary.

Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
---
 numa.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/numa.c b/numa.c
index f004a74..722a7fe 100644
--- a/numa.c
+++ b/numa.c
@@ -190,6 +190,17 @@ static void validate_numa_cpus(void)
         bitmap_or(present_cpus, present_cpus,
                   numa_info[i].node_cpu, MAX_CPUMASK_BITS);
     }
+
+    cpu = find_first_zero_bit(present_cpus, MAX_CPUMASK_BITS);
+    if (cpu < max_cpus) {
+        fprintf(stderr, "warning: CPU(s) not present in any NUMA nodes:");
+        for (;
+            cpu < max_cpus;
+            cpu = find_next_zero_bit(present_cpus, MAX_CPUMASK_BITS, cpu + 1)) 
{
+            fprintf(stderr, " %d", cpu);
+        }
+        fprintf(stderr, "\n");
+    }
 }
 
 void parse_numa_opts(void)
-- 
2.1.0


Reply via email to