From patchwork Thu Apr 19 09:22:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/1] sparc: task_cpu() for stopper thread on sparc32 returns 0 Date: Wed, 18 Apr 2012 23:22:42 -0000 From: Konrad Eisele X-Patchwork-Id: 153710 Message-Id: <1334827362-3434-1-git-send-email-konrad@gaisler.com> To: sparclinux@vger.kernel.org, davem@davemloft.net Cc: daniel@gaisler.com, sam@ravnborg.org, konrad@gaisler.com The stopper thread for CPU > 0 (at least in sparc32) has on initialization task_cpu() set to zero even for CPUs > 0. The patch explicitly checks weather the CPU is allowed to run on the cpu that task_cpu() return or changes the return cpu. Signed-off-by: Konrad Eisele --- kernel/sched/stop_task.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/kernel/sched/stop_task.c b/kernel/sched/stop_task.c index 7b386e8..9201866 100644 --- a/kernel/sched/stop_task.c +++ b/kernel/sched/stop_task.c @@ -13,7 +13,14 @@ static int select_task_rq_stop(struct task_struct *p, int sd_flag, int flags) { - return task_cpu(p); /* stop tasks as never migrate */ + int ccpu, cpu , dcpu; + ccpu = cpu = task_cpu(p); + if (unlikely(!cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))) { + cpu = cpumask_first(tsk_cpus_allowed(p)); + if (cpu >= nr_cpu_ids) + cpu = ccpu; + } + return cpu; } #endif /* CONFIG_SMP */