diff --git a/classify.c b/classify.c index 271e50c..f73b2f4 100644 --- a/classify.c +++ b/classify.c @@ -180,15 +180,15 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct u get_numa_node: numa_node = -1; - sprintf(path, "%s/numa_node", devpath); - fd = fopen(path, "r"); - if (!fd) - goto assign_node; + if (numa_avail) { + sprintf(path, "%s/numa_node", devpath); + fd = fopen(path, "r"); + if (fd) { + rc = fscanf(fd, "%d", &numa_node); + fclose(fd); + } + } - rc = fscanf(fd, "%d", &numa_node); - fclose(fd); - -assign_node: if (pol->numa_node_set == 1) new->numa_node = get_numa_node(pol->numa_node); else diff --git a/cputree.c b/cputree.c index b7aa7b8..caedbb6 100644 --- a/cputree.c +++ b/cputree.c @@ -261,17 +261,19 @@ static void do_one_cpu(char *path) } nodeid=-1; - dir = opendir(path); - do { - entry = readdir(dir); - if (!entry) - break; - if (strstr(entry->d_name, "node")) { - nodeid = strtoul(&entry->d_name[4], NULL, 10); - break; - } - } while (entry); - closedir(dir); + if (numa_avail) { + dir = opendir(path); + do { + entry = readdir(dir); + if (!entry) + break; + if (strstr(entry->d_name, "node")) { + nodeid = strtoul(&entry->d_name[4], NULL, 10); + break; + } + } while (entry); + closedir(dir); + } /* blank out the banned cpus from the various masks so that interrupts diff --git a/numa.c b/numa.c index 1820fbe..ff3f169 100644 --- a/numa.c +++ b/numa.c @@ -89,7 +89,7 @@ static void add_one_node(const char *nodename) void build_numa_node_list(void) { - DIR *dir = opendir(SYSFS_NODE_PATH); + DIR *dir; struct dirent *entry; /* @@ -104,6 +104,10 @@ void build_numa_node_list(void) */ numa_nodes = g_list_append(numa_nodes, &unspecified_node); + if (!numa_avail) + return; + + dir = opendir(SYSFS_NODE_PATH); if (!dir) return;