Skip to content

sched: Fix DL server starvation under core scheduling

Fernand Sieber linux-kselftest lkml stable 1 version Applied

Status from this message: The following commit has been merged into the sched/urgent branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/5sched/core: Clear stale rq->dl_server when core-sched replaces a pickkernel/sched/core.c+6 -00 replies
2/5sched/core: Keep a sibling's DL server link in the core-wide pickkernel/sched/core.c+1 -22 replies
3/5sched/core: Rank DL server picks as deadline in the core-wide pickkernel/sched/core.c+34 -161 reply
4/5sched/deadline: Don't charge core-sched forced idle to the DL serverskernel/sched/idle.c kernel/sched/sched.h+22 -00 replies
5/5selftests/sched: Add a core-sched forced-idle DL server testtools/testing/selftests/sched/.gitignore tools/testing/selftests/sched/Makefile tools/testing/selftests/sched/config +1 more+408 -31 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] sched: Fix DL server starvation under core scheduling

Under core scheduling the class a DL server reserves CPU time for gets almost nothing. With the default fair server (50 ms / 1 s), a CFS task spinning on one SMT sibling beside a cookied SCHED_FIFO task on the other measures 0.000% of its CPU instead of the reserved 5%. The ext server starves sched_ext tasks the same way.

Two independent mechanisms are at fault. The core-wide selection mishandles the rq->dl_server hand-off: a stale link is passed to idle (which then forces the siblings idle and trips the forced-idle WARN), a sibling's link is lost on the fast path, and picks are ranked before p->dl_server is set (patches 1-3, Fixes: bd9bbc96e835). Independently, a deferred server is charged its rq's forced-idle time, so its runtime runs out while it is still throttled, replenish_dl_new_period() pushes the activation a full period out, and the next period of forced idle pushes it again (patch 4, Fixes: a110a81c52a9). Either fix alone leaves the share at ~0%.

Patch 5 adds cs_dl_server_test to selftests/sched: a cookied FIFO spinner on one sibling, an uncookied CFS spinner on the other, and a check of the CFS share of that CPU against half the fair server's reservation, 2.5% by default. Run under QEMU with -smp 4,cores=2,threads=2.

Over a 5 s window, plain tip fails 10/10 at 0.000%, and with the whole series it passes 31/31 at 3.99-5.19%.

This series was prepared with the help of an AI coding assistant. I have reviewed and tested all of it.

Fernand Sieber (5):
sched/core: Clear stale rq->dl_server when core-sched replaces a pick sched/core: Keep a sibling's DL server link in the core-wide pick sched/core: Rank DL server picks as deadline in the core-wide pick sched/deadline: Don't charge core-sched forced idle to the DL servers selftests/sched: Add a core-sched forced-idle DL server test

 kernel/sched/core.c                           |  59 ++-
 kernel/sched/idle.c                           |   7 +
 kernel/sched/sched.h                          |  15 +
 tools/testing/selftests/sched/.gitignore      |   1 +
 tools/testing/selftests/sched/Makefile        |   4 +-
 tools/testing/selftests/sched/config          |   4 +-
 .../selftests/sched/cs_dl_server_test.c       | 402 ++++++++++++++++++
 7 files changed, 471 insertions(+), 21 deletions(-)
 create mode 100644 tools/testing/selftests/sched/cs_dl_server_test.c

base-commit: d7e670601af6c564ccf6d3b2ddf70ee4f41a6d1c

Signature · 8 lines
2.47.3




Amazon Development Centre (South Africa) (Proprietary) Limited
29 Gogosoa Street, Observatory, Cape Town, Western Cape, 7925, South Africa
Registration Number: 2004 / 034463 / 07