core fixes for 3.9
Subsystems (4)
Linus,
please pull the latest core-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-urgent-for-linus
* A single bugfix which plugs two race confitions which can cause hotplug per cpu threads to end up on the wrong cpu.
Thanks,
tglx
------------------>
Thomas Gleixner (1):
kthread: Prevent unpark race which puts threads on the wrong cpu
fs/proc/array.c | 1 + include/linux/sched.h | 5 ++- include/trace/events/sched.h | 2 +- kernel/kthread.c | 52 ++++++++++++++++++++++------------------- kernel/smpboot.c | 14 +++++++++- 5 files changed, 45 insertions(+), 29 deletions(-)
fs/proc/array.c +1 -0
@@ -143,6 +143,7 @@ static const char * const task_state_array[] = {"x (dead)" ,/* 64 */ "K (wakekill)" ,/* 128 */ "W (waking)" ,/* 256 */ + "P (parked)", /* 512 */ };static inline const char *get_task_state (struct task_struct *tsk)
include/linux/sched.h +3 -2
@@ -163,9 +163,10 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)#define TASK_DEAD 64#define TASK_WAKEKILL 128#define TASK_WAKING 256 -#define TASK_STATE_MAX 512 +#define TASK_PARKED 512 +#define TASK_STATE_MAX 1024 -#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" +#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKWP"extern char ___assert_task_state[1 -2 *!!(sizeof (TASK_STATE_TO_CHAR_STR )-1 !=ilog2 (TASK_STATE_MAX )+1 )];
include/trace/events/sched.h +1 -1
@@ -147,7 +147,7 @@ TRACE_EVENT(sched_switch,__print_flags (__entry->prev_state & (TASK_STATE_MAX -1 ),"|" , { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, { 16, "Z" }, { 32, "X" }, { 64, "x" }, - { 128, "W" }) : "R", + { 128, "K" }, { 256, "W" }, { 512, "P" }) : "R", __entry->prev_state &TASK_STATE_MAX ?"+" :"" , __entry->next_comm, __entry->next_pid, __entry->next_prio) );
kernel/kthread.c +28 -24
93 lines not on this page · raw message
kernel/smpboot.c +12 -2
@@ -185,8 +185,18 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu) }get_task_struct (tsk); *per_cpu_ptr (ht->store, cpu) = tsk; -if (ht->create) - ht->create (cpu); +if (ht->create) { +/* +* Make sure that the task has actually scheduled out +* into park position, before calling the create +* callback. At least the migration thread callback +* requires that the task is off the runqueue. +*/ +if (!wait_task_inactive (tsk,TASK_PARKED )) +WARN_ON (1 ); +else + ht->create (cpu); + }return 0 ; }