sched/fair: Stop core-scheduled siblings trading rescheduling IPIs
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | sched/fair: Renew slice protection when current is picked againkernel/ | +7 | 0 replies | |
| 2/2 | selftests/sched: Add a core scheduling rescheduling IPI testtools/ tools/ tools/ +1 more | +381 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] sched/fair: Stop core-scheduled siblings trading rescheduling IPIs
Since v6.17, two SMT siblings under core scheduling can keep sending each other rescheduling IPIs, thousands per CPU per second, while each keeps running the same task.
Commit 0b9ca2dcabc3 ("sched/fair: Always trigger resched at the end of a protected period") makes update_curr() ask for a reschedule once the running entity's protected period has expired. set_protect_slice() only rearms that period on a fresh pick (SNT_PICK), so an entity that is picked again keeps an expired vprot and every later update_curr() on it asks again. Under core scheduling the ask is remote: a core wide pick calls pick_task() - hence update_curr() - on every sibling's runqueue, so each sibling IPIs the other, which schedules, re-picks the same entity, renews nothing, and IPIs back.
Patch 1 renews the protection on a repick. Patch 2 adds a selftest that cookies one SMT pair, runs two spinners on each sibling and fails above 1000 rescheduling IPIs per CPU per second. It reproduces in a 4 vCPU QEMU guest (-smp 4,sockets=1,cores=2,threads=2) with CONFIG_SCHED_CORE=y and CONFIG_PREEMPT_LAZY=n: without patch 1 it fails 6 runs out of 7, at 808-2123 IPIs/CPU/s; with it all 7 pass, at 224-271.
This series, including the changelogs, was prepared with the help of an AI coding assistant; I have reviewed and tested all of it.
Fernand Sieber (2):
sched/fair: Renew slice protection when current is picked again selftests/sched: Add a core scheduling rescheduling IPI test
kernel/sched/fair.c | 7 + tools/testing/selftests/sched/.gitignore | 1 + tools/testing/selftests/sched/Makefile | 4 +- tools/testing/selftests/sched/config | 2 +- .../selftests/sched/cs_resched_ipi_test.c | 377 ++++++++++++++++++ 5 files changed, 388 insertions(+), 3 deletions(-) create mode 100644 tools/testing/selftests/sched/cs_resched_ipi_test.c
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