]> git.dujemihanovic.xyz Git - linux.git/commit
sched: Fix priority inversion of cookied task with sibling
authorJoel Fernandes (Google) <joel@joelfernandes.org>
Tue, 17 Nov 2020 23:19:42 +0000 (18:19 -0500)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 12 May 2021 09:43:29 +0000 (11:43 +0200)
commit7afbba119f0da09824d723f8081608ea1f74ff57
tree0f148eeb6823454ff60b49d2b4974a9699a8643e
parent8039e96fcc1de30d5bcaf05da9ca2de46a800826
sched: Fix priority inversion of cookied task with sibling

The rationale is as follows. In the core-wide pick logic, even if
need_sync == false, we need to go look at other CPUs (non-local CPUs)
to see if they could be running RT.

Say the RQs in a particular core look like this:

Let CFS1 and CFS2 be 2 tagged CFS tags.
Let RT1 be an untagged RT task.

rq0 rq1
CFS1 (tagged) RT1 (no tag)
CFS2 (tagged)

Say schedule() runs on rq0. Now, it will enter the above loop and
pick_task(RT) will return NULL for 'p'. It will enter the above if()
block and see that need_sync == false and will skip RT entirely.

The end result of the selection will be (say prio(CFS1) > prio(CFS2)):

rq0             rq1
CFS1            IDLE

When it should have selected:

rq0             rq1
IDLE            RT

Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Don Hiatt <dhiatt@digitalocean.com>
Tested-by: Hongyu Ning <hongyu.ning@linux.intel.com>
Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210422123308.678425748@infradead.org
kernel/sched/core.c