_cpu_down() changes the current task's affinity and then recovers it at
the end. It has two problems: 1) The recovery of the current tasks's cpus_allowed will fail under some conditions. # grep Cpus_allowed_list /proc/$$/status Cpus_allowed_list: 0-3 # taskset -pc 2 $$ pid 29075's current affinity list: 0-3 pid 29075's new affinity list: 2 # grep Cpus_allowed_list /proc/$$/status Cpus_allowed_list: 2 # echo 0 > /sys/devices/system/cpu/cpu2/online # grep Cpus_allowed_list /proc/$$/status Cpus_allowed_list: 0 Here, the Cpus_allowed_list was originally "2" and has become "0-1,3" after cpu #2 is offlined. This "Cpus_allowed_list: 0" is incorrect. 2) If the current task is a userspace task, the user may change its cpu-affinity during the CPU hot-unplugging. This change can be overwritten when _cpu_down() changes the current task's affinity. Fix all this by not changing the current tasks's affinity. Instead we create a kernel thread to do the work. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Showing
Please register or sign in to comment