diff options
author | Oleg Nesterov <oleg@redhat.com> | 2010-03-15 10:10:23 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-09-20 13:18:08 -0700 |
commit | 1ccc5a299bd54b1c0f0bac6316c45b6ce31b9ac1 (patch) | |
tree | 8e4e92d989100659a613d82ab952f1a277db1f96 /kernel/sched.c | |
parent | cc28db464250bd240299431cc4fd7b7d58b205d2 (diff) | |
download | linux-stable-1ccc5a299bd54b1c0f0bac6316c45b6ce31b9ac1.tar.gz linux-stable-1ccc5a299bd54b1c0f0bac6316c45b6ce31b9ac1.tar.bz2 linux-stable-1ccc5a299bd54b1c0f0bac6316c45b6ce31b9ac1.zip |
sched: _cpu_down(): Don't play with current->cpus_allowed
commit 6a1bdc1b577ebcb65f6603c57f8347309bc4ab13 upstream
_cpu_down() changes the current task's affinity and then recovers it at
the end. The problems are well known: we can't restore old_allowed if it
was bound to the now-dead-cpu, and we can race with the userspace which
can change cpu-affinity during unplug.
_cpu_down() should not play with current->cpus_allowed at all. Instead,
take_cpu_down() can migrate the caller of _cpu_down() after __cpu_disable()
removes the dying cpu from cpu_online_mask.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20100315091023.GA9148@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index cd170605cf7b..4541bf324ac6 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -7393,7 +7393,7 @@ static int migration_thread(void *data) /* * Figure out where task on dead CPU should go, use force if necessary. */ -static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p) +void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p) { struct rq *rq = cpu_rq(dead_cpu); int needs_cpu, uninitialized_var(dest_cpu); |