diff options
author | Tianchen Ding <dtcccc@linux.alibaba.com> | 2022-06-09 02:34:11 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-17 16:16:02 +0300 |
commit | 31ef9288a5938ebbf577b10b40087d5745be544f (patch) | |
tree | c56b757aa00d1544b26cb5e953167788881a6ad9 /samples | |
parent | 035f2184fed3cc825d8083a5e62d45a5e99b21d0 (diff) | |
download | linux-31ef9288a5938ebbf577b10b40087d5745be544f.tar.xz |
sched: Fix the check of nr_running at queue wakelist
[ Upstream commit 28156108fecb1f808b21d216e8ea8f0d205a530c ]
The commit 2ebb17717550 ("sched/core: Offload wakee task activation if it
the wakee is descheduling") checked rq->nr_running <= 1 to avoid task
stacking when WF_ON_CPU.
Per the ordering of writes to p->on_rq and p->on_cpu, observing p->on_cpu
(WF_ON_CPU) in ttwu_queue_cond() implies !p->on_rq, IOW p has gone through
the deactivate_task() in __schedule(), thus p has been accounted out of
rq->nr_running. As such, the task being the only runnable task on the rq
implies reading rq->nr_running == 0 at that point.
The benchmark result is in [1].
[1] https://lore.kernel.org/all/e34de686-4e85-bde1-9f3c-9bbc86b38627@linux.alibaba.com/
Suggested-by: Valentin Schneider <vschneid@redhat.com>
Signed-off-by: Tianchen Ding <dtcccc@linux.alibaba.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <vschneid@redhat.com>
Link: https://lore.kernel.org/r/20220608233412.327341-2-dtcccc@linux.alibaba.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions