Commit 1d292c60 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] NUMA fixes

From: Anton Blanchard <anton@samba.org>


Anton has been testing odd setups:

/* node 0 - no cpus, no memory */
/* node 1 - 1 cpu, no memory */
/* node 2 - 0 cpus, 1GB memory */
/* node 3 - 3 cpus, 3GB memory */

Two things tripped so far.  Firstly the ppc64 debug check for invalid cpus
in cpu_to_node().  Fix that in kernel/sched.c:node_nr_running_init().

The other problem concerned nodes with memory but no cpus.  kswapd tries to
set_cpus_allowed(0) and bad things happen.  So we only set cpu affinity
for kswapd if there are cpus in the node.
parent 16996799
...@@ -219,8 +219,11 @@ __init void node_nr_running_init(void) ...@@ -219,8 +219,11 @@ __init void node_nr_running_init(void)
{ {
int i; int i;
for (i = 0; i < NR_CPUS; i++) for (i = 0; i < NR_CPUS; i++) {
cpu_rq(i)->node_nr_running = &node_nr_running[cpu_to_node(i)]; if (cpu_possible(i))
cpu_rq(i)->node_nr_running =
&node_nr_running[cpu_to_node(i)];
}
} }
#else /* !CONFIG_NUMA */ #else /* !CONFIG_NUMA */
......
...@@ -956,9 +956,12 @@ int kswapd(void *p) ...@@ -956,9 +956,12 @@ int kswapd(void *p)
struct reclaim_state reclaim_state = { struct reclaim_state reclaim_state = {
.reclaimed_slab = 0, .reclaimed_slab = 0,
}; };
unsigned long cpumask;
daemonize("kswapd%d", pgdat->node_id); daemonize("kswapd%d", pgdat->node_id);
set_cpus_allowed(tsk, node_to_cpumask(pgdat->node_id)); cpumask = node_to_cpumask(pgdat->node_id);
if (cpumask)
set_cpus_allowed(tsk, cpumask);
current->reclaim_state = &reclaim_state; current->reclaim_state = &reclaim_state;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment