diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-07-20 19:11:55 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-07-20 19:11:55 +0200 |
commit | d69f558692723b34ced07d07f092db7a8f78cae9 (patch) | |
tree | f450249400fcae96f7c216dbf41015d2d5772c20 /include | |
parent | 111abc89fbfb6b34de96d95bf90bcfdfcfac901d (diff) | |
download | lwn-d69f558692723b34ced07d07f092db7a8f78cae9.tar.gz lwn-d69f558692723b34ced07d07f092db7a8f78cae9.zip |
0017d735092844118bef006696a750a0e4ef6ebd
commit 0017d735092844118bef006696a750a0e4ef6ebd
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Wed Mar 24 18:34:10 2010 +0100
sched: Fix TASK_WAKING vs fork deadlock
Oleg noticed a few races with the TASK_WAKING usage on fork.
- since TASK_WAKING is basically a spinlock, it should be IRQ safe
- since we set TASK_WAKING (*) without holding rq->lock it could
be there still is a rq->lock holder, thereby not actually
providing full serialization.
(*) in fact we clear PF_STARTING, which in effect enables TASK_WAKING.
Cure the second issue by not setting TASK_WAKING in sched_fork(), but
only temporarily in wake_up_new_task() while calling select_task_rq().
Cure the first by holding rq->lock around the select_task_rq() call,
this will disable IRQs, this however requires that we push down the
rq->lock release into select_task_rq_fair()'s cgroup stuff.
Because select_task_rq_fair() still needs to drop the rq->lock we
cannot fully get rid of TASK_WAKING.
Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sched.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 32c3f6cd4d7f..82d06e3ed04b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1170,7 +1170,8 @@ struct sched_class { void (*put_prev_task) (struct rq *rq, struct task_struct *p); #ifdef CONFIG_SMP - int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); + int (*select_task_rq)(struct rq *rq, struct task_struct *p, + int sd_flag, int flags); unsigned long (*load_balance) (struct rq *this_rq, int this_cpu, struct rq *busiest, unsigned long max_load_move, |