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:
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

View File

@ -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

6
numa.c
View File

@ -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;