aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-11-24 18:29:20 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-26 01:58:29 -0500
commit1224e376f2a7e3c7ab19ef37099a78597978a696 (patch)
tree244bbf8c345ac70487ddcb6283c7895f6cbdb7dd /kernel/sched.c
parent3d8cbdf8650f44d95333ca645d950832a0653f35 (diff)
sched: avoid stack var in move_task_off_dead_cpu, fix
Impact: locking fix We can't call cpuset_cpus_allowed_locked() with the rq lock held. However, the rq lock merely protects us from (1) cpu_online_mask changing and (2) someone else changing p->cpus_allowed. The first can't happen because we're being called from a cpu hotplug notifier. The second doesn't really matter: we are forcing the task off a CPU it was affine to, so we're not doing very well anyway. So we remove the rq lock from this path, and all is good. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Mike Travis <travis@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 1aa840a9f585..3f5bfdc3d94d 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6126,8 +6126,6 @@ static int __migrate_task_irq(struct task_struct *p, int src_cpu, int dest_cpu)
6126 */ 6126 */
6127static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p) 6127static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
6128{ 6128{
6129 unsigned long flags;
6130 struct rq *rq;
6131 int dest_cpu; 6129 int dest_cpu;
6132 /* FIXME: Use cpumask_of_node here. */ 6130 /* FIXME: Use cpumask_of_node here. */
6133 cpumask_t _nodemask = node_to_cpumask(cpu_to_node(dead_cpu)); 6131 cpumask_t _nodemask = node_to_cpumask(cpu_to_node(dead_cpu));
@@ -6146,10 +6144,8 @@ again:
6146 6144
6147 /* No more Mr. Nice Guy. */ 6145 /* No more Mr. Nice Guy. */
6148 if (dest_cpu >= nr_cpu_ids) { 6146 if (dest_cpu >= nr_cpu_ids) {
6149 rq = task_rq_lock(p, &flags);
6150 cpuset_cpus_allowed_locked(p, &p->cpus_allowed); 6147 cpuset_cpus_allowed_locked(p, &p->cpus_allowed);
6151 dest_cpu = cpumask_any_and(cpu_online_mask, &p->cpus_allowed); 6148 dest_cpu = cpumask_any_and(cpu_online_mask, &p->cpus_allowed);
6152 task_rq_unlock(rq, &flags);
6153 6149
6154 /* 6150 /*
6155 * Don't tell them about moving exiting tasks or 6151 * Don't tell them about moving exiting tasks or