diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-06-25 09:21:04 +0200 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-04-24 21:44:56 -0400 |
commit | 8ec0c82702e9384399c5c8295f721a24f21934a2 (patch) | |
tree | 0f85da78f1a660c3694a2c14c9d39567d2961e66 /kernel/sched | |
parent | efa86cc1e9f0ff62345e8e389f48f6428765e598 (diff) | |
download | linux-rt-8ec0c82702e9384399c5c8295f721a24f21934a2.tar.gz |
sched-rt-mutex-wakeup.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/core.c | 31 | ||||
-rw-r--r-- | kernel/sched/sched.h | 1 |
2 files changed, 31 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4f8e30941918..44be15aca67c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1504,8 +1504,25 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) */ smp_mb__before_spinlock(); raw_spin_lock_irqsave(&p->pi_lock, flags); - if (!(p->state & state)) + if (!(p->state & state)) { + /* + * The task might be running due to a spinlock sleeper + * wakeup. Check the saved state and set it to running + * if the wakeup condition is true. + */ + if (!(wake_flags & WF_LOCK_SLEEPER)) { + if (p->saved_state & state) + p->saved_state = TASK_RUNNING; + } goto out; + } + + /* + * If this is a regular wakeup, then we can unconditionally + * clear the saved state of a "lock sleeper". + */ + if (!(wake_flags & WF_LOCK_SLEEPER)) + p->saved_state = TASK_RUNNING; success = 1; /* we're going to change ->state */ cpu = task_cpu(p); @@ -1602,6 +1619,18 @@ int wake_up_process(struct task_struct *p) } EXPORT_SYMBOL(wake_up_process); +/** + * wake_up_lock_sleeper - Wake up a specific process blocked on a "sleeping lock" + * @p: The process to be woken up. + * + * Same as wake_up_process() above, but wake_flags=WF_LOCK_SLEEPER to indicate + * the nature of the wakeup. + */ +int wake_up_lock_sleeper(struct task_struct *p) +{ + return try_to_wake_up(p, TASK_ALL, WF_LOCK_SLEEPER); +} + int wake_up_state(struct task_struct *p, unsigned int state) { return try_to_wake_up(p, state, 0); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 4f310592b1ba..ca613741f275 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -898,6 +898,7 @@ static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev) #define WF_SYNC 0x01 /* waker goes to sleep after wakeup */ #define WF_FORK 0x02 /* child wakeup after fork */ #define WF_MIGRATED 0x4 /* internal use, task got migrated */ +#define WF_LOCK_SLEEPER 0x08 /* wakeup spinlock "sleeper" */ /* * To aid in avoiding the subversion of "niceness" due to uneven distribution |