sched: Fix DL server starvation under core scheduling
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
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | sched/core: Clear stale rq->dl_server when core-sched replaces a pickkernel/ | +6 | 0 replies | |
| 2/5 | sched/core: Keep a sibling's DL server link in the core-wide pickkernel/ | +1 | 2 replies | |
| 3/5 | sched/core: Rank DL server picks as deadline in the core-wide pickkernel/ | +34 | 1 reply | |
| 4/5 | sched/deadline: Don't charge core-sched forced idle to the DL serverskernel/ kernel/ | +22 | 0 replies | |
| 5/5 | selftests/sched: Add a core-sched forced-idle DL server testtools/ tools/ tools/ +1 more | +408 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
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