@@ -94,13 +94,27 @@ discover_numa_and_core(void)
{
int n_cpus = 0;
int i;
+ DIR *dir;
+ char* path;
+ bool has_numa = 1;
+ int max_numa_nodes = MAX_NUMA_NODES;
+
+
+ path = xasprintf("/sys/devices/system/node");
+ dir = opendir(path);
+ free(path);
+ if (!dir) {
+ has_numa = 0;
+ max_numa_nodes = 1;
+ }
- for (i = 0; i < MAX_NUMA_NODES; i++) {
- DIR *dir;
- char* path;
-
+ for (i = 0; i < max_numa_nodes; i++) {
/* Constructs the path to node /sys/devices/system/nodeX. */
- path = xasprintf("/sys/devices/system/node/node%d", i);
+ if (has_numa) {
+ path = xasprintf("/sys/devices/system/node/node%d", i);
+ } else {
+ path = xasprintf("/sys/devices/system/cpu");
+ }
dir = opendir(path);
/* Creates 'struct numa_node' if the 'dir' is non-null. */
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> --- This is a workaround to make odp-ovs compile on KS2 which has no NUMA support. It might make it as a proper fix, because the only thing needed is the list of cpus, and the number of numa nodes can very well be 1. lib/ovs-numa.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)