diff options
| author | Dmitry Shmidt <dimitrysh@google.com> | 2016-09-26 10:37:43 -0700 |
|---|---|---|
| committer | Dmitry Shmidt <dimitrysh@google.com> | 2016-09-26 10:37:43 -0700 |
| commit | 734bcf32c23442e81891641ae05e08108a4010d5 (patch) | |
| tree | b41cc318506b0c38ddf404520ba67753f3ab5452 /kernel/sched/core.c | |
| parent | 551569f25ec07596e144ffbc7911dd631645e63b (diff) | |
| parent | 8d5e93bb8c9c48ee5948f6b1aff0e895381f09e6 (diff) | |
Merge tag 'v4.4.22' into android-4.4.y
This is the 4.4.22 stable release
Change-Id: Id49e3c87d2cacb2fa85d85a17226f718f4a5ac28
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 778335a7140c..01cb249109cc 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1966,6 +1966,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; |
