diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-09-05 13:24:11 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-09-05 13:24:11 +0200 |
commit | 62cc20bcf25617dd5ad23356ea46830da3ef7356 (patch) | |
tree | afc8bd217bd3227d26b4aebf3526723c28fe3a08 /kernel/sched/core.c | |
parent | a1eb1411b4e4251db02179e39d234c2ee5192c72 (diff) | |
parent | 135e8c9250dd5c8c9aae5984fde6f230d0cbfeaf (diff) |
Merge branch 'sched/urgent' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 69243142cad1..7d602f508ca1 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2016,6 +2016,28 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) success = 1; /* we're going to change ->state */ cpu = task_cpu(p); + /* + * Ensure we load p->on_rq _after_ p->state, otherwise it would + * be possible to, falsely, observe p->on_rq == 0 and get stuck + * in smp_cond_load_acquire() below. + * + * sched_ttwu_pending() try_to_wake_up() + * [S] p->on_rq = 1; [L] P->state + * UNLOCK rq->lock -----. + * \ + * +--- RMB + * schedule() / + * LOCK rq->lock -----' + * UNLOCK rq->lock + * + * [task p] + * [S] p->state = UNINTERRUPTIBLE [L] p->on_rq + * + * Pairs with the UNLOCK+LOCK on rq->lock from the + * last wakeup of our task and the schedule that got our task + * current. + */ + smp_rmb(); if (p->on_rq && ttwu_remote(p, wake_flags)) goto stat; |