NUMA is not available fix

When NUMA is not available (build wihout numa lib or system has no NUMA)
some irqs were lost and can't be balanced.

Signed-off-by: serj.kalichev@gmail.com
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
Serj Kalichev 2013-10-10 16:16:50 +04:00 committed by Neil Horman
parent b43c5f6a95
commit a3c812eb6c
3 changed files with 26 additions and 20 deletions

View file

@ -180,15 +180,15 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct u
get_numa_node: get_numa_node:
numa_node = -1; numa_node = -1;
sprintf(path, "%s/numa_node", devpath); if (numa_avail) {
fd = fopen(path, "r"); sprintf(path, "%s/numa_node", devpath);
if (!fd) fd = fopen(path, "r");
goto assign_node; 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) if (pol->numa_node_set == 1)
new->numa_node = get_numa_node(pol->numa_node); new->numa_node = get_numa_node(pol->numa_node);
else else

View file

@ -261,17 +261,19 @@ static void do_one_cpu(char *path)
} }
nodeid=-1; nodeid=-1;
dir = opendir(path); if (numa_avail) {
do { dir = opendir(path);
entry = readdir(dir); do {
if (!entry) entry = readdir(dir);
break; if (!entry)
if (strstr(entry->d_name, "node")) { break;
nodeid = strtoul(&entry->d_name[4], NULL, 10); if (strstr(entry->d_name, "node")) {
break; nodeid = strtoul(&entry->d_name[4], NULL, 10);
} break;
} while (entry); }
closedir(dir); } while (entry);
closedir(dir);
}
/* /*
blank out the banned cpus from the various masks so that interrupts blank out the banned cpus from the various masks so that interrupts

6
numa.c
View file

@ -89,7 +89,7 @@ static void add_one_node(const char *nodename)
void build_numa_node_list(void) void build_numa_node_list(void)
{ {
DIR *dir = opendir(SYSFS_NODE_PATH); DIR *dir;
struct dirent *entry; struct dirent *entry;
/* /*
@ -104,6 +104,10 @@ void build_numa_node_list(void)
*/ */
numa_nodes = g_list_append(numa_nodes, &unspecified_node); numa_nodes = g_list_append(numa_nodes, &unspecified_node);
if (!numa_avail)
return;
dir = opendir(SYSFS_NODE_PATH);
if (!dir) if (!dir)
return; return;