linux/kernel
Oleg Nesterov 6a1bdc1b57 sched: _cpu_down(): Don't play with current->cpus_allowed
_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>
2010-04-02 20:12:03 +02:00
..
gcov
irq Merge branch 'irq-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-26 15:09:06 -07:00
power mm/pm: force GFP_NOIO during suspend/hibernation and resume 2010-03-06 11:26:26 -08:00
time Merge branch 'linus' into sched/core 2010-04-02 20:03:08 +02:00
trace Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-26 15:10:13 -07:00
.gitignore
acct.c copy_signal() cleanup: kill taskstats_tgid_init() and acct_init_pacct() 2010-03-12 15:52:39 -08:00
async.c
audit_tree.c new helper: iterate_mounts() 2010-03-03 14:07:57 -05:00
audit_watch.c
audit.c Fix misspelling of "should" and "shouldn't" in comments. 2010-02-05 12:22:30 +01:00
audit.h
auditfilter.c
auditsc.c Lose the first argument of audit_inode_child() 2010-02-08 14:38:36 -05:00
backtracetest.c
bounds.c
capability.c sched: Remove remaining USER_SCHED code 2010-04-02 20:12:00 +02:00
cgroup_freezer.c
cgroup.c cgroups: remove duplicate include 2010-03-24 16:31:19 -07:00
compat.c
configs.c
cpu.c sched: _cpu_down(): Don't play with current->cpus_allowed 2010-04-02 20:12:03 +02:00
cpuset.c sched: Kill the broken and deadlockable cpuset_lock/cpuset_cpus_allowed_locked code 2010-04-02 20:12:01 +02:00
cred.c sched: Remove remaining USER_SCHED code 2010-04-02 20:12:00 +02:00
delayacct.c
dma.c
early_res.c x86: Do not free zero sized per cpu areas 2010-03-29 18:55:40 +02:00
elfcore.c elf coredump: add extended numbering support 2010-03-06 11:26:46 -08:00
exec_domain.c
exit.c sched: Remove remaining USER_SCHED code 2010-04-02 20:12:00 +02:00
extable.c
fork.c Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-13 14:43:01 -08:00
freezer.c
futex_compat.c
futex.c futex: Handle futex value corruption gracefully 2010-02-03 15:13:22 +01:00
groups.c
hrtimer.c
hung_task.c
hw_breakpoint.c Merge branch 'perf/core' into perf/urgent 2010-03-04 11:47:52 +01:00
itimer.c
kallsyms.c
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
kexec.c percpu: add __percpu sparse annotations to core kernel subsystems 2010-02-17 11:17:38 +09:00
kfifo.c kfifo: Don't use integer as NULL pointer 2010-02-16 15:11:08 -08:00
kgdb.c Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-02-04 16:07:41 -08:00
kmod.c
kprobes.c kprobes: Calculate the index correctly when freeing the out-of-line execution slot 2010-03-11 14:06:16 +01:00
ksysfs.c Merge branch 'for-next' into for-linus 2010-03-08 16:55:37 +01:00
kthread.c cpuset: fix the problem that cpuset_mem_spread_node() returns an offline node 2010-03-24 16:31:21 -07:00
latencytop.c
lockdep_internals.h
lockdep_proc.c
lockdep_states.h
lockdep.c Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-18 16:52:46 -07:00
Makefile elf coredump: replace ELF_CORE_EXTRA_* macros by functions 2010-03-06 11:26:45 -08:00
module.c sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on module dynamic attributes 2010-03-07 17:04:51 -08:00
mutex-debug.c
mutex-debug.h
mutex.c
mutex.h
notifier.c sched: Use lockdep-based checking on rcu_dereference() 2010-02-25 10:34:26 +01:00
ns_cgroup.c
nsproxy.c nsproxy: remove INIT_NSPROXY() 2010-03-12 15:52:40 -08:00
padata.c padata: Allocate the cpumask for the padata instance 2010-03-04 13:30:22 +08:00
panic.c panic: fix panic_timeout accuracy when running on a hypervisor 2010-03-06 11:26:33 -08:00
params.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-03-12 16:04:50 -08:00
perf_event.c perf: Fix unexported generic perf_arch_fetch_caller_regs 2010-03-17 12:26:49 +01:00
pid_namespace.c pid_ns: zap_pid_ns_processes: use SEND_SIG_NOINFO instead of force_sig() 2010-03-12 15:52:40 -08:00
pid.c Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-13 14:43:01 -08:00
pm_qos_params.c
posix-cpu-timers.c Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-26 15:10:38 -07:00
posix-timers.c posix-timers.c: Don't export local functions 2010-02-05 14:54:10 +01:00
printk.c printk: avoid warning when CONFIG_PRINTK is disabled 2010-03-06 11:26:33 -08:00
profile.c
ptrace.c ptrace: Fix ptrace_regset() comments and diagnose errors specifically 2010-02-23 13:45:26 -08:00
range.c x86: Change range end to start+size 2010-02-10 17:47:17 -08:00
rcupdate.c rcu: Make rcu_read_lock_bh_held() allow for disabled BH 2010-03-16 09:57:49 +01:00
rcutiny.c
rcutorture.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2010-03-03 07:34:18 -08:00
rcutree_plugin.h rcu: Fix holdoff for accelerated GPs for last non-dynticked CPU 2010-02-28 09:17:42 +01:00
rcutree_trace.c rcu: Stop overflowing signed integers 2010-02-25 10:34:57 +01:00
rcutree.c rcu: Fix accelerated grace periods for last non-dynticked CPU 2010-02-27 09:53:52 +01:00
rcutree.h rcu: Increase RCU CPU stall timeouts if PROVE_RCU 2010-03-11 13:38:01 +01:00
relay.c splice: comparing unsigned int < 0 2010-03-06 11:26:32 -08:00
res_counter.c
resource.c resources: add interfaces that return conflict information 2010-03-23 13:33:50 -07:00
rtmutex_common.h
rtmutex-debug.c
rtmutex-debug.h
rtmutex-tester.c
rtmutex.c
rtmutex.h
rwsem.c
sched_clock.c
sched_cpupri.c Merge branch 'for-next' into for-linus 2010-03-08 16:55:37 +01:00
sched_cpupri.h
sched_debug.c sched: Remove remaining USER_SCHED code 2010-04-02 20:12:00 +02:00
sched_fair.c Merge branch 'linus' into sched/core 2010-04-02 20:03:08 +02:00
sched_features.h sched: Remove ASYM_GRAN feature 2010-03-11 18:32:53 +01:00
sched_idletask.c sched: Remove the sched_class load_balance methods 2010-01-21 13:40:09 +01:00
sched_rt.c Merge branch 'linus' into sched/core 2010-04-02 20:03:08 +02:00
sched_stats.h
sched.c sched: _cpu_down(): Don't play with current->cpus_allowed 2010-04-02 20:12:03 +02:00
seccomp.c
semaphore.c
signal.c kernel core: use helpers for rlimits 2010-03-06 11:26:33 -08:00
slow-work-debugfs.c
slow-work.c slow-work: use get_ref wrapper instead of directly calling get_ref 2010-03-29 09:13:30 -07:00
slow-work.h SLOW_WORK: CONFIG_SLOW_WORK_PROC should be CONFIG_SLOW_WORK_DEBUG 2010-03-29 09:14:47 -07:00
smp.c generic-ipi: Optimize accesses by using DEFINE_PER_CPU_SHARED_ALIGNED for IPI data 2010-01-18 09:02:59 +01:00
softirq.c hrtimer, softirq: Fix hrtimer->softirq trampoline 2010-02-03 18:17:40 +01:00
softlockup.c softlockup: Stop spurious softlockup messages due to overflow 2010-03-21 19:30:13 +01:00
spinlock.c
srcu.c rcu: Introduce lockdep-based checking to RCU read-side primitives 2010-02-25 09:40:59 +01:00
stacktrace.c
stop_machine.c percpu: add __percpu sparse annotations to core kernel subsystems 2010-02-17 11:17:38 +09:00
sys_ni.c Add generic sys_ipc wrapper 2010-03-12 15:52:32 -08:00
sys.c Add generic sys_olduname() 2010-03-12 15:52:32 -08:00
sysctl_binary.c Switch may_open() and break_lease() to passing O_... 2010-03-03 13:00:21 -05:00
sysctl_check.c
sysctl.c sysctl extern cleanup: lockdep 2010-03-12 15:53:10 -08:00
taskstats.c const: struct nla_policy 2010-02-18 14:30:18 -08:00
test_kprobes.c
time.c
timeconst.pl
timer.c timer stats: Fix del_timer_sync() and try_to_del_timer_sync() 2010-03-12 19:11:29 +01:00
tracepoint.c
tsacct.c mm: clean up mm_counter 2010-03-06 11:26:23 -08:00
uid16.c
up.c
user_namespace.c
user-return-notifier.c
user.c sched: Remove remaining USER_SCHED code 2010-04-02 20:12:00 +02:00
utsname_sysctl.c
utsname.c
wait.c
workqueue.c