Skip to contentSkip to conversation

sched: Fix DL server starvation under core scheduling

PATCH Applied Fernand Sieber 4 participants 21 messages Nov 12 – Nov 24

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover 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
#1 lore raw

PATCH 1/5 sched/core: Clear stale rq->dl_server when core-sched replaces a pick

With core scheduling and the fair server, the forced-idle accounting warns from an idle core:

  WARNING: kernel/sched/core_sched.c:263 at __sched_core_account_forceidle+0x1d6/0x1f0, CPU#0: swapper/0/0

The core is in forced idle with no sibling running a task. The reason is a stale rq->dl_server causing the idle task to incorrectly be considered as carried by the deadline server. The idle task then wins over a runnable sibling task and the whole core is idle despite having runnable tasks.

The timeline below describes the issue:

Setup. CPU0 and CPU1 are SMT siblings.
- CPU1 runs R, a SCHED_FIFO task with cookie X.
- CPU0 has C, a CFS task with no cookie, which has been starved. So CPU0's fair server is due to step in.

t0, CPU0 picks for the core.
- pick_task(rq0) goes through the deadline class, which picks the fair server, which picks C. As a side effect it sets rq0->dl_server = &rq0->fair_server.
- pick_task(rq1) picks R.

t1, ranking. C->dl_server is only set once C is switched in, so C ranks as CFS. R (RT) beats C (CFS), so the core cookie becomes X.

t2, matching. CPU0's pick C has cookie 0, not X, so it is replaced. There is no cookie-X task on CPU0, so the replacement is idle, and CPU0 is forced idle.
- The code sets rq0->core_pick = idle and rq0->core_dl_server = NULL.
- The bug: it leaves rq0->dl_server pointing at CPU0's fair server, even though idle didn't come through any server.

t3, CPU0 switches. CPU0 is the selecting CPU, so next = idle, and put_prev_set_next_task() hands the stale rq0->dl_server to it. Now idle->dl_server is CPU0's fair server.

t4, C leaves. Load balancing moves C to another core, so CPU0 has nothing runnable. The stale link stays on idle.

t5, the next core-wide selection (when CPU1 reschedules, say on a wakeup).
- CPU0's pick is idle, and the ranking sees idle->dl_server set, so it ranks idle as a deadline task.
- idle now beats R, and the core cookie becomes idle's cookie, 0.
- CPU1's R has cookie X, not 0, so CPU1 is forced idle.

t6, result. The whole core is idle. R is runnable but can't run, and nothing runs on either CPU. That's the WARN in __sched_core_account_forceidle(): forced idle with no sibling running a task. It lasts until CPU0 goes through a full schedule that resets its server link.

With this patch, step t2 also does rq0->dl_server = NULL. At t3 idle gets no server, and at t5 it ranks as plain idle, so R wins and keeps running on CPU1.

Fixes bd9bbc96e835 ("sched: Rework dl_server")
---
 kernel/sched/core.c | 6 ++++++
 1 file changed, 6 insertions(+)
kernel/sched/core.c +6 -0
index 175b52a7ea793..f7ac13186ee59 100644
@@ -6453,6 +6453,12 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 				p = sched_core_find(rq_i, cookie);
 			if (!p)
 				p = idle_sched_class.pick_task(rq_i, rf);
+
+			/*
+			 * Neither a core tree pick nor idle comes through a
+			 * DL server; drop the one the replaced pick left.
+			 */
+			rq_i->dl_server = NULL;
 		}
 
 		rq_i->core_pick = p;
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
merge bot Applied
#2 lore raw

[tip: sched/urgent] sched/deadline: Clear stale rq->dl_server when core-sched replaces a pick

The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     5b65edb7f582803cda84552990779610ca22581c
Gitweb:        https://git.kernel.org/tip/5b65edb7f582803cda84552990779610ca22581c
Author:        Fernand Sieber <[email protected]>
AuthorDate:    Thu, 12 Nov 2026 18:15:44 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Sun, 22 Nov 2026 16:16:27 +01:00

sched/deadline: Clear stale rq->dl_server when core-sched replaces a pick

With core scheduling and the fair server, the forced-idle accounting warns from an idle core:

  WARNING: kernel/sched/core_sched.c:263 at __sched_core_account_forceidle+0x1d6/0x1f0, CPU#0: swapper/0/0

The core is in forced idle with no sibling running a task. The reason is a stale rq->dl_server causing the idle task to incorrectly be considered as carried by the deadline server. The idle task then wins over a runnable sibling task and the whole core is idle despite having runnable tasks.

The timeline below describes the issue:

Setup. CPU0 and CPU1 are SMT siblings.
- CPU1 runs R, a SCHED_FIFO task with cookie X.
- CPU0 has C, a CFS task with no cookie, which has been starved. So CPU0's fair server is due to step in.

t0, CPU0 picks for the core.
- pick_task(rq0) goes through the deadline class, which picks the fair server, which picks C. As a side effect it sets rq0->dl_server = &rq0->fair_server.
- pick_task(rq1) picks R.

t1, ranking. C->dl_server is only set once C is switched in, so C ranks as CFS. R (RT) beats C (CFS), so the core cookie becomes X.

t2, matching. CPU0's pick C has cookie 0, not X, so it is replaced. There is no cookie-X task on CPU0, so the replacement is idle, and CPU0 is forced idle.
- The code sets rq0->core_pick = idle and rq0->core_dl_server = NULL.
- The bug: it leaves rq0->dl_server pointing at CPU0's fair server, even though idle didn't come through any server.

t3, CPU0 switches. CPU0 is the selecting CPU, so next = idle, and put_prev_set_next_task() hands the stale rq0->dl_server to it. Now idle->dl_server is CPU0's fair server.

t4, C leaves. Load balancing moves C to another core, so CPU0 has nothing runnable. The stale link stays on idle.

t5, the next core-wide selection (when CPU1 reschedules, say on a wakeup).
- CPU0's pick is idle, and the ranking sees idle->dl_server set, so it ranks idle as a deadline task.
- idle now beats R, and the core cookie becomes idle's cookie, 0.
- CPU1's R has cookie X, not 0, so CPU1 is forced idle.

t6, result. The whole core is idle. R is runnable but can't run, and nothing runs on either CPU. That's the WARN in __sched_core_account_forceidle(): forced idle with no sibling running a task. It lasts until CPU0 goes through a full schedule that resets its server link.

With this patch, step t2 also does rq0->dl_server = NULL. At t3 idle gets no server, and at t5 it ranks as plain idle, so R wins and keeps running on CPU1.

---
 kernel/sched/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/sched/core.c +6 -1
index 515b9d0..42b99be 100644
@@ -6453,10 +6453,15 @@ restart:
 				p = sched_core_find(rq_i, cookie);
 			if (!p)
 				p = idle_sched_class.pick_task(rq_i, rf);
+
+			/*
+			 * Neither a core tree pick nor idle comes through a
+			 * DL server; drop the one the replaced pick left.
+			 */
+			rq_i->core_dl_server = rq_i->dl_server = NULL;
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = NULL;
 
 		if (p == rq_i->idle) {
 			if (rq_i->nr_running) {
merge bot Applied
#3 lore raw

[tip: sched/urgent] sched/deadline: Clear stale rq->dl_server when core-sched replaces a pick

In reply to Fernand Sieber
The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     d2583cb031135d3e2f6eeec9049fc2066fd3655c
Gitweb:        https://git.kernel.org/tip/d2583cb031135d3e2f6eeec9049fc2066fd3655c
Author:        Fernand Sieber <[email protected]>
AuthorDate:    Thu, 12 Nov 2026 18:15:44 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Mon, 23 Nov 2026 10:38:26 +01:00

sched/deadline: Clear stale rq->dl_server when core-sched replaces a pick

With core scheduling and the fair server, the forced-idle accounting warns from an idle core:

  WARNING: kernel/sched/core_sched.c:263 at __sched_core_account_forceidle+0x1d6/0x1f0, CPU#0: swapper/0/0

The core is in forced idle with no sibling running a task. The reason is a stale rq->dl_server causing the idle task to incorrectly be considered as carried by the deadline server. The idle task then wins over a runnable sibling task and the whole core is idle despite having runnable tasks.

The timeline below describes the issue:

Setup. CPU0 and CPU1 are SMT siblings.
- CPU1 runs R, a SCHED_FIFO task with cookie X.
- CPU0 has C, a CFS task with no cookie, which has been starved. So CPU0's fair server is due to step in.

t0, CPU0 picks for the core.
- pick_task(rq0) goes through the deadline class, which picks the fair server, which picks C. As a side effect it sets rq0->dl_server = &rq0->fair_server.
- pick_task(rq1) picks R.

t1, ranking. C->dl_server is only set once C is switched in, so C ranks as CFS. R (RT) beats C (CFS), so the core cookie becomes X.

t2, matching. CPU0's pick C has cookie 0, not X, so it is replaced. There is no cookie-X task on CPU0, so the replacement is idle, and CPU0 is forced idle.
- The code sets rq0->core_pick = idle and rq0->core_dl_server = NULL.
- The bug: it leaves rq0->dl_server pointing at CPU0's fair server, even though idle didn't come through any server.

t3, CPU0 switches. CPU0 is the selecting CPU, so next = idle, and put_prev_set_next_task() hands the stale rq0->dl_server to it. Now idle->dl_server is CPU0's fair server.

t4, C leaves. Load balancing moves C to another core, so CPU0 has nothing runnable. The stale link stays on idle.

t5, the next core-wide selection (when CPU1 reschedules, say on a wakeup).
- CPU0's pick is idle, and the ranking sees idle->dl_server set, so it ranks idle as a deadline task.
- idle now beats R, and the core cookie becomes idle's cookie, 0.
- CPU1's R has cookie X, not 0, so CPU1 is forced idle.

t6, result. The whole core is idle. R is runnable but can't run, and nothing runs on either CPU. That's the WARN in __sched_core_account_forceidle(): forced idle with no sibling running a task. It lasts until CPU0 goes through a full schedule that resets its server link.

With this patch, step t2 also does rq0->dl_server = NULL. At t3 idle gets no server, and at t5 it ranks as plain idle, so R wins and keeps running on CPU1.

---
 kernel/sched/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/sched/core.c +6 -1
index 515b9d0..42b99be 100644
@@ -6453,10 +6453,15 @@ restart:
 				p = sched_core_find(rq_i, cookie);
 			if (!p)
 				p = idle_sched_class.pick_task(rq_i, rf);
+
+			/*
+			 * Neither a core tree pick nor idle comes through a
+			 * DL server; drop the one the replaced pick left.
+			 */
+			rq_i->core_dl_server = rq_i->dl_server = NULL;
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = NULL;
 
 		if (p == rq_i->idle) {
 			if (rq_i->nr_running) {
#4 lore raw

PATCH 2/5 sched/core: Keep a sibling's DL server link in the core-wide pick

In reply to Fernand Sieber

The core-wide selection records in rq_i->core_dl_server the DL server each sibling's pick came through, then clears it for every sibling in the cookie matching loop, including when the pick is kept. The sibling takes the fast path, which sets rq->dl_server from rq->core_dl_server, and runs the task its server picked with p->dl_server NULL. Only the selecting CPU keeps the link, as its pick goes through rq->dl_server.

A running task is ranked for core scheduling by p->dl_server. While such a task runs on a sibling, each following core-wide selection ranks it as a plain fair or ext task rather than by its server's deadline, so a higher class task on another sibling takes the core back before the server's runtime is used. The RV nomiss monitor, which follows the server through next->dl_server at sched_switch, does not see the server run either.

Keep the server that pick_task() left in rq_i->dl_server. With the previous patch it is NULL when the class pick was replaced. Drop the assignment in the first loop, which the matching loop always overwrites.

Fixes bd9bbc96e835 ("sched: Rework dl_server")
---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +1 -2
index f7ac13186ee59..61d4e6e990bba 100644
@@ -6431,7 +6431,6 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = rq_i->dl_server;
 
 		if (!max || prio_less(max, p, fi_before))
 			max = p;
@@ -6462,7 +6461,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = NULL;
+		rq_i->core_dl_server = rq_i->dl_server;
 
 		if (p == rq_i->idle) {
 			if (rq_i->nr_running) {
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
maintainer
#5 lore raw

Re: [PATCH 2/5] sched/core: Keep a sibling's DL server link in the core-wide pick

Quoted 39 lines · Fernand Sieber

The core-wide selection records in rq_i->core_dl_server the DL server each sibling's pick came through, then clears it for every sibling in the cookie matching loop, including when the pick is kept. The sibling takes the fast path, which sets rq->dl_server from rq->core_dl_server, and runs the task its server picked with p->dl_server NULL. Only the selecting CPU keeps the link, as its pick goes through rq->dl_server.

A running task is ranked for core scheduling by p->dl_server. While such a task runs on a sibling, each following core-wide selection ranks it as a plain fair or ext task rather than by its server's deadline, so a higher class task on another sibling takes the core back before the server's runtime is used. The RV nomiss monitor, which follows the server through next->dl_server at sched_switch, does not see the server run either.

Keep the server that pick_task() left in rq_i->dl_server. With the previous patch it is NULL when the class pick was replaced. Drop the assignment in the first loop, which the matching loop always overwrites.

Fixes bd9bbc96e835 ("sched: Rework dl_server")
---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +0 -1
index f7ac13186ee59..61d4e6e990bba 100644
@@ -6431,7 +6431,6 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = rq_i->dl_server;
 
 		if (!max || prio_less(max, p, fi_before))
 			max = p;

kernel/sched/core.c pick_next_task(struct rq *rq, struct rq_flags *rf) · line 6467

Quoted 8 lines
kernel/sched/core.c +1 -1
@@ -6462,7 +6461,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = NULL;
+		rq_i->core_dl_server = rq_i->dl_server;
 
 		if (p == rq_i->idle) {
 			if (rq_i->nr_running) {

Isn't this broken in the face of a rq->lock drop through pick_task() ?

Consider this does:

SMT0: pick_task()
SMT1: pick_task()

          drop rq->lock
	    newidle
  SMT0: rq_0->core_dl_server = rq_0->dl_server;

I am reworking all of that somewhere, but delaying saving rq->dl_server like this feels fragile.

Can't we fold the first two patches into something like so?

---

kernel/sched/core.c +7 -1
index 175b52a7ea79..68b980ddf88f 100644
@@ -6453,10 +6453,16 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 				p = sched_core_find(rq_i, cookie);
 			if (!p)
 				p = idle_sched_class.pick_task(rq_i, rf);
+
+			/*
+			 * Neither a core tree pick nor idle comes through a
+			 * DL server; drop the one the replaced pick left.
+			 */
+			rq_i->dl_server = NULL;
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = NULL;
+		rq_i->core_dl_server = rq_i->dl_server;
 
 		if (p == rq_i->idle) {
 			if (rq_i->nr_running) {
maintainer
#6 lore raw

Re: [PATCH 2/5] sched/core: Keep a sibling's DL server link in the core-wide pick

Quoted 76 lines · Peter Zijlstra
Quoted 39 lines · Fernand Sieber

The core-wide selection records in rq_i->core_dl_server the DL server each sibling's pick came through, then clears it for every sibling in the cookie matching loop, including when the pick is kept. The sibling takes the fast path, which sets rq->dl_server from rq->core_dl_server, and runs the task its server picked with p->dl_server NULL. Only the selecting CPU keeps the link, as its pick goes through rq->dl_server.

A running task is ranked for core scheduling by p->dl_server. While such a task runs on a sibling, each following core-wide selection ranks it as a plain fair or ext task rather than by its server's deadline, so a higher class task on another sibling takes the core back before the server's runtime is used. The RV nomiss monitor, which follows the server through next->dl_server at sched_switch, does not see the server run either.

Keep the server that pick_task() left in rq_i->dl_server. With the previous patch it is NULL when the class pick was replaced. Drop the assignment in the first loop, which the matching loop always overwrites.

Fixes bd9bbc96e835 ("sched: Rework dl_server")
---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +0 -1
index f7ac13186ee59..61d4e6e990bba 100644
@@ -6431,7 +6431,6 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = rq_i->dl_server;
 
 		if (!max || prio_less(max, p, fi_before))
 			max = p;

kernel/sched/core.c pick_next_task(struct rq *rq, struct rq_flags *rf) · line 6467

Quoted 8 lines
kernel/sched/core.c +1 -1
@@ -6462,7 +6461,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = NULL;
+		rq_i->core_dl_server = rq_i->dl_server;
 
 		if (p == rq_i->idle) {
 			if (rq_i->nr_running) {

Isn't this broken in the face of a rq->lock drop through pick_task() ?

Consider this does:

SMT0: pick_task()
SMT1: pick_task()

          drop rq->lock
	    newidle
  SMT0: rq_0->core_dl_server = rq_0->dl_server;

I am reworking all of that somewhere, but delaying saving rq->dl_server like this feels fragile.

Can't we fold the first two patches into something like so?

---

kernel/sched/core.c +1 -0
index 175b52a7ea79..68b980ddf88f 100644
@@ -6453,10 +6453,16 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 				p = sched_core_find(rq_i, cookie);
 			if (!p)
 				p = idle_sched_class.pick_task(rq_i, rf);
+

kernel/sched/core.c pick_next_task(struct rq *rq, struct rq_flags *rf) · line 6465

Quoted 10 lines
kernel/sched/core.c +6 -1
+			/*
+			 * Neither a core tree pick nor idle comes through a
+			 * DL server; drop the one the replaced pick left.
+			 */
+			rq_i->dl_server = NULL;
 		}
 
 		rq_i->core_pick = p;
-		rq_i->core_dl_server = NULL;
+		rq_i->core_dl_server = rq_i->dl_server;

No that isn't quite right either, perhaps just make it:

			rq_i->core_dl_server = rq_i->dl_server = NULL;
#7 lore raw

PATCH 3/5 sched/core: Rank DL server picks as deadline in the core-wide pick

In reply to Fernand Sieber

Commit 4b26cfdd3956 ("sched/core: Fix priority checking for DL server picks") made the core-wide selection rank a task picked through a DL server as deadline, so that a fair task competing with RT tasks under core scheduling still gets its server's bandwidth. It keys on p->dl_server, which pick_task() used to set.

Since commit bd9bbc96e835 ("sched: Rework dl_server"), pick_task() records the server in rq->dl_server and p->dl_server is only set once the task is switched in. The core-wide selection still ranks each sibling's pick with prio_less(), so a task the sibling's server has just picked ranks as a plain fair or ext task and loses to an RT task on another sibling. The server's CPU then runs a task with the RT task's cookie or is forced idle, and the fair task gets none of the server's bandwidth for as long as the RT task runs.

Rank each sibling's pick by the server it came through, rq_i->dl_server. prio_less() keeps using p->dl_server for the core tree, whose tasks are not being picked.

Fixes bd9bbc96e835 ("sched: Rework dl_server")
---
 kernel/sched/core.c | 50 ++++++++++++++++++++++++++++++---------------
 1 file changed, 34 insertions(+), 16 deletions(-)
kernel/sched/core.c +34 -16
index 61d4e6e990bba..ffe8a41380d0e 100644
@@ -196,12 +196,13 @@ __read_mostly int scheduler_running;
 DEFINE_STATIC_KEY_FALSE(__sched_core_enabled);
 
 /* kernel prio, less is more */
-static inline int __task_prio(const struct task_struct *p)
+static inline int __task_prio(const struct task_struct *p,
+			      const struct sched_dl_entity *dl_server)
 {
 	if (p->sched_class == &stop_sched_class) /* trumps deadline */
 		return -2;
 
-	if (p->dl_server)
+	if (dl_server)
 		return -1; /* deadline */
 
 	if (rt_or_dl_prio(p->prio))
@@ -223,12 +224,19 @@ static inline int __task_prio(const struct task_struct *p)
  * ge(a,b) := !l(a,b)
  */
 
-/* real prio, less is less */
-static inline bool prio_less(const struct task_struct *a,
-			     const struct task_struct *b, bool in_fi)
+/*
+ * real prio, less is less
+ *
+ * @a_dl_server and @b_dl_server are the DL servers @a and @b run on
+ * behalf of, if any.
+ */
+static inline bool __prio_less(const struct task_struct *a,
+			       const struct sched_dl_entity *a_dl_server,
+			       const struct task_struct *b,
+			       const struct sched_dl_entity *b_dl_server,
+			       bool in_fi)
 {
-
-	int pa = __task_prio(a), pb = __task_prio(b);
+	int pa = __task_prio(a, a_dl_server), pb = __task_prio(b, b_dl_server);
 
 	if (-pa < -pb)
 		return true;
@@ -239,18 +247,13 @@ static inline bool prio_less(const struct task_struct *a,
 	if (pa == -1) { /* dl_prio() doesn't work because of stop_class above */
 		const struct sched_dl_entity *a_dl, *b_dl;
 
-		a_dl = &a->dl;
 		/*
-		 * Since,'a' and 'b' can be CFS tasks served by DL server,
+		 * Since 'a' and 'b' can be tasks served by a DL server,
 		 * __task_prio() can return -1 (for DL) even for those. In that
 		 * case, get to the dl_server's DL entity.
 		 */
-		if (a->dl_server)
-			a_dl = a->dl_server;
-
-		b_dl = &b->dl;
-		if (b->dl_server)
-			b_dl = b->dl_server;
+		a_dl = a_dl_server ?: &a->dl;
+		b_dl = b_dl_server ?: &b->dl;
 
 		return !dl_time_before(a_dl->deadline, b_dl->deadline);
 	}
@@ -266,6 +269,12 @@ static inline bool prio_less(const struct task_struct *a,
 	return false;
 }
 
+static inline bool prio_less(const struct task_struct *a,
+			     const struct task_struct *b, bool in_fi)
+{
+	return __prio_less(a, a->dl_server, b, b->dl_server, in_fi);
+}
+
 static inline bool __sched_core_less(const struct task_struct *a,
 				     const struct task_struct *b)
 {
@@ -6297,6 +6306,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 	__must_hold(__rq_lockp(rq))
 {
 	struct task_struct *next, *p, *max;
+	struct sched_dl_entity *max_dl_server;
 	bool fi_before = false;
 	bool core_clock_updated = (rq == rq->core);
 	unsigned long cookie;
@@ -6410,6 +6420,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 	 * Tie-break prio towards the current CPU
 	 */
 	max = NULL;
+	max_dl_server = NULL;
 	for_each_core_cpu_wrap(i, rq) {
 		rq_i = cpu_rq(i);
 
@@ -6432,8 +6443,15 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 
 		rq_i->core_pick = p;
 
-		if (!max || prio_less(max, p, fi_before))
+		/*
+		 * p->dl_server is only set once @p runs; rank a pick that
+		 * came through a DL server by that server.
+		 */
+		if (!max || __prio_less(max, max_dl_server, p, rq_i->dl_server,
+					fi_before)) {
 			max = p;
+			max_dl_server = rq_i->dl_server;
+		}
 	}
 
 	cookie = rq->core->core_cookie = max->core_cookie;
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
maintainer
#8 lore raw

Re: [PATCH 3/5] sched/core: Rank DL server picks as deadline in the core-wide pick

Quoted 15 lines · Fernand Sieber

Commit 4b26cfdd3956 ("sched/core: Fix priority checking for DL server picks") made the core-wide selection rank a task picked through a DL server as deadline, so that a fair task competing with RT tasks under core scheduling still gets its server's bandwidth. It keys on p->dl_server, which pick_task() used to set.

Since commit bd9bbc96e835 ("sched: Rework dl_server"), pick_task() records the server in rq->dl_server and p->dl_server is only set once the task is switched in. The core-wide selection still ranks each sibling's pick with prio_less(), so a task the sibling's server has just picked ranks as a plain fair or ext task and loses to an RT task on another sibling. The server's CPU then runs a task with the RT task's cookie or is forced idle, and the fair task gets none of the server's bandwidth for as long as the RT task runs.

Quoted 4 lines

Rank each sibling's pick by the server it came through, rq_i->dl_server. prio_less() keeps using p->dl_server for the core tree, whose tasks are not being picked.

I don't love this, but I don't see another way either, so yes.

merge bot Applied
#9 lore raw

[tip: sched/core] sched/core: Rank DL server picks as deadline in the core-wide pick

In reply to Fernand Sieber
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     87a825f3c680474eeb5c2a28398ad625bb69319e
Gitweb:        https://git.kernel.org/tip/87a825f3c680474eeb5c2a28398ad625bb69319e
Author:        Fernand Sieber <[email protected]>
AuthorDate:    Thu, 12 Nov 2026 18:15:46 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Mon, 23 Nov 2026 10:45:41 +01:00

sched/core: Rank DL server picks as deadline in the core-wide pick

Commit 4b26cfdd3956 ("sched/core: Fix priority checking for DL server picks") made the core-wide selection rank a task picked through a DL server as deadline, so that a fair task competing with RT tasks under core scheduling still gets its server's bandwidth. It keys on p->dl_server, which pick_task() used to set.

Since commit bd9bbc96e835 ("sched: Rework dl_server"), pick_task() records the server in rq->dl_server and p->dl_server is only set once the task is switched in. The core-wide selection still ranks each sibling's pick with prio_less(), so a task the sibling's server has just picked ranks as a plain fair or ext task and loses to an RT task on another sibling. The server's CPU then runs a task with the RT task's cookie or is forced idle, and the fair task gets none of the server's bandwidth for as long as the RT task runs.

Rank each sibling's pick by the server it came through, rq_i->dl_server. prio_less() keeps using p->dl_server for the core tree, whose tasks are not being picked.

---
 kernel/sched/core.c | 51 ++++++++++++++++++++++++++++++--------------
 1 file changed, 35 insertions(+), 16 deletions(-)
kernel/sched/core.c +35 -16
index 46ccaa8..ea89471 100644
@@ -196,12 +196,13 @@ __read_mostly int scheduler_running;
 DEFINE_STATIC_KEY_FALSE(__sched_core_enabled);
 
 /* kernel prio, less is more */
-static inline int __task_prio(const struct task_struct *p)
+static inline int __task_prio(const struct task_struct *p,
+			      const struct sched_dl_entity *dl_server)
 {
 	if (p->sched_class == &stop_sched_class) /* trumps deadline */
 		return -2;
 
-	if (p->dl_server)
+	if (dl_server)
 		return -1; /* deadline */
 
 	if (rt_or_dl_prio(p->prio))
@@ -223,12 +224,19 @@ static inline int __task_prio(const struct task_struct *p)
  * ge(a,b) := !l(a,b)
  */
 
-/* real prio, less is less */
-static inline bool prio_less(const struct task_struct *a,
-			     const struct task_struct *b, bool in_fi)
+/*
+ * real prio, less is less
+ *
+ * @a_dl_server and @b_dl_server are the DL servers @a and @b run on
+ * behalf of, if any.
+ */
+static inline bool __prio_less(const struct task_struct *a,
+			       const struct sched_dl_entity *a_dl_server,
+			       const struct task_struct *b,
+			       const struct sched_dl_entity *b_dl_server,
+			       bool in_fi)
 {
-
-	int pa = __task_prio(a), pb = __task_prio(b);
+	int pa = __task_prio(a, a_dl_server), pb = __task_prio(b, b_dl_server);
 
 	if (-pa < -pb)
 		return true;
@@ -239,18 +247,13 @@ static inline bool prio_less(const struct task_struct *a,
 	if (pa == -1) { /* dl_prio() doesn't work because of stop_class above */
 		const struct sched_dl_entity *a_dl, *b_dl;
 
-		a_dl = &a->dl;
 		/*
-		 * Since,'a' and 'b' can be CFS tasks served by DL server,
+		 * Since 'a' and 'b' can be tasks served by a DL server,
 		 * __task_prio() can return -1 (for DL) even for those. In that
 		 * case, get to the dl_server's DL entity.
 		 */
-		if (a->dl_server)
-			a_dl = a->dl_server;
-
-		b_dl = &b->dl;
-		if (b->dl_server)
-			b_dl = b->dl_server;
+		a_dl = a_dl_server ?: &a->dl;
+		b_dl = b_dl_server ?: &b->dl;
 
 		return !dl_time_before(a_dl->deadline, b_dl->deadline);
 	}
@@ -266,6 +269,12 @@ static inline bool prio_less(const struct task_struct *a,
 	return false;
 }
 
+static inline bool prio_less(const struct task_struct *a,
+			     const struct task_struct *b, bool in_fi)
+{
+	return __prio_less(a, a->dl_server, b, b->dl_server, in_fi);
+}
+
 static inline bool __sched_core_less(const struct task_struct *a,
 				     const struct task_struct *b)
 {
@@ -6316,6 +6325,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 	__must_hold(__rq_lockp(rq))
 {
 	struct task_struct *next, *p, *max;
+	struct sched_dl_entity *max_dl_server;
 	bool fi_before = false;
 	bool core_clock_updated = (rq == rq->core);
 	unsigned long cookie;
@@ -6429,6 +6439,7 @@ restart:
 	 * Tie-break prio towards the current CPU
 	 */
 	max = NULL;
+	max_dl_server = NULL;
 	for_each_core_cpu_wrap(i, rq) {
 		rq_i = cpu_rq(i);
 
@@ -6452,8 +6463,16 @@ restart:
 		rq_i->core_pick = p;
 		rq_i->core_dl_server = rq_i->dl_server;
 
-		if (!max || prio_less(max, p, fi_before))
+		/*
+		 * p->dl_server is only set once @p runs; rank a pick that
+		 * came through a DL server by that server.
+		 */
+		if (!max || __prio_less(max, max_dl_server,
+					p, rq_i->dl_server,
+					fi_before)) {
 			max = p;
+			max_dl_server = rq_i->dl_server;
+		}
 	}
 
 	cookie = rq->core->core_cookie = max->core_cookie;
#10 lore raw

PATCH 4/5 sched/deadline: Don't charge core-sched forced idle to the DL servers

In reply to Fernand Sieber

A deferred DL server is charged the idle time of its rq, on the premise that the time was available to the server's class and went unused. Core scheduling breaks that premise: a CPU is forced idle when a SMT sibling runs a task with an incompatible cookie, so that time was available to no class at all.

update_curr_dl_se() then runs the server's runtime out while it is throttled and calls replenish_dl_new_period(), pushing the activation a full period out. dl_defer_idle does not help, as idle_rq() is false on a forced-idle CPU: nr_running is not 0. Every period of forced idle pushes the activation again, the zero-laxity timer never fires, and the class the server reserves for gets nothing.

Reproduction on 2 cores x 2 threads with the default fair server (50 ms / 1 s): a SCHED_FIFO spinner with a core-sched cookie on CPU0 and an uncookied CFS spinner on CPU1 force-idle CPU1, and the CFS task gets under 0.1% of a CPU instead of the reserved 5%. The ext server starves sched_ext tasks the same way, and there a plain CFS spinner on the sibling is enough.

Don't charge forced idle. A server still only loses runtime to real execution or real idle, and one whose class has nothing to run still stops through dl_defer_idle once the rq is idle for real; with core scheduling off nothing changes. Getting the reserved bandwidth back also needs the server's pick to win the core-wide selection, which the preceding sched/core patches fix.

Fixes a110a81c52a9 ("sched/deadline: Deferrable dl server")
---
 kernel/sched/idle.c  |  7 +++++++
 kernel/sched/sched.h | 15 +++++++++++++++
 2 files changed, 22 insertions(+)
kernel/sched/idle.c +7 -0
index f7dd151f77920..451b4846219d5 100644
@@ -573,6 +573,13 @@ static void update_curr_idle(struct rq *rq)
 
 	se->exec_start = now;
 
+	/*
+	 * Forced idle was not time available to any class on this rq, so
+	 * don't let the deferred servers consume their runtime on it.
+	 */
+	if (forced_idle_rq(rq))
+		return;
+
 	dl_server_update_idle(&rq->fair_server, delta_exec);
 #ifdef CONFIG_SCHED_CLASS_EXT
 	dl_server_update_idle(&rq->ext_server, delta_exec);
kernel/sched/sched.h +15 -0
index a4df59c9c9b60..f3b22c4bd6782 100644
@@ -1525,6 +1525,16 @@ static inline bool sched_core_disabled(void)
 	return !static_branch_unlikely(&__sched_core_enabled);
 }
 
+/*
+ * True while core scheduling keeps @rq idle because a SMT sibling runs a task
+ * with an incompatible cookie, even though @rq has runnable tasks of its own.
+ */
+static inline bool forced_idle_rq(struct rq *rq)
+{
+	return sched_core_enabled(rq) && rq->core->core_forceidle_count &&
+	       rq->nr_running;
+}
+
 /*
  * Be careful with this function; not for general use. The return value isn't
  * stable unless you actually hold a relevant rq->__lock.
@@ -1659,6 +1669,11 @@ static inline bool sched_core_disabled(void)
 	return true;
 }
 
+static inline bool forced_idle_rq(struct rq *rq)
+{
+	return false;
+}
+
 static inline raw_spinlock_t *rq_lockp(struct rq *rq)
 {
 	return &rq->__lock;
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
merge bot Applied
#11 lore raw

[tip: sched/urgent] sched/deadline: Don't charge core-sched forced idle to the DL servers

The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     051820698aae32c571a66720327f793e2077c0fa
Gitweb:        https://git.kernel.org/tip/051820698aae32c571a66720327f793e2077c0fa
Author:        Fernand Sieber <[email protected]>
AuthorDate:    Thu, 12 Nov 2026 18:15:47 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Sun, 22 Nov 2026 16:16:35 +01:00

sched/deadline: Don't charge core-sched forced idle to the DL servers

A deferred DL server is charged the idle time of its rq, on the premise that the time was available to the server's class and went unused. Core scheduling breaks that premise: a CPU is forced idle when a SMT sibling runs a task with an incompatible cookie, so that time was available to no class at all.

update_curr_dl_se() then runs the server's runtime out while it is throttled and calls replenish_dl_new_period(), pushing the activation a full period out. dl_defer_idle does not help, as idle_rq() is false on a forced-idle CPU: nr_running is not 0. Every period of forced idle pushes the activation again, the zero-laxity timer never fires, and the class the server reserves for gets nothing.

Reproduction on 2 cores x 2 threads with the default fair server (50 ms / 1 s): a SCHED_FIFO spinner with a core-sched cookie on CPU0 and an uncookied CFS spinner on CPU1 force-idle CPU1, and the CFS task gets under 0.1% of a CPU instead of the reserved 5%. The ext server starves sched_ext tasks the same way, and there a plain CFS spinner on the sibling is enough.

Don't charge forced idle. A server still only loses runtime to real execution or real idle, and one whose class has nothing to run still stops through dl_defer_idle once the rq is idle for real; with core scheduling off nothing changes. Getting the reserved bandwidth back also needs the server's pick to win the core-wide selection, which the preceding sched/core patches fix.

---
 kernel/sched/idle.c  |  7 +++++++
 kernel/sched/sched.h | 15 +++++++++++++++
 2 files changed, 22 insertions(+)
kernel/sched/idle.c +7 -0
index e0c10a5..717d566 100644
@@ -573,6 +573,13 @@ static void update_curr_idle(struct rq *rq)
 
 	se->exec_start = now;
 
+	/*
+	 * Forced idle was not time available to any class on this rq, so
+	 * don't let the deferred servers consume their runtime on it.
+	 */
+	if (forced_idle_rq(rq))
+		return;
+
 	dl_server_update_idle(&rq->fair_server, delta_exec);
 #ifdef CONFIG_SCHED_CLASS_EXT
 	dl_server_update_idle(&rq->ext_server, delta_exec);
kernel/sched/sched.h +15 -0
index a4e6696..804c703 100644
@@ -1522,6 +1522,16 @@ static inline bool sched_core_disabled(void)
 }
 
 /*
+ * True while core scheduling keeps @rq idle because a SMT sibling runs a task
+ * with an incompatible cookie, even though @rq has runnable tasks of its own.
+ */
+static inline bool forced_idle_rq(struct rq *rq)
+{
+	return sched_core_enabled(rq) && rq->core->core_forceidle_count &&
+	       rq->nr_running;
+}
+
+/*
  * Be careful with this function; not for general use. The return value isn't
  * stable unless you actually hold a relevant rq->__lock.
  */
@@ -1655,6 +1665,11 @@ static inline bool sched_core_disabled(void)
 	return true;
 }
 
+static inline bool forced_idle_rq(struct rq *rq)
+{
+	return false;
+}
+
 static inline raw_spinlock_t *rq_lockp(struct rq *rq)
 {
 	return &rq->__lock;
merge bot Applied
#12 lore raw

[tip: sched/urgent] sched/deadline: Don't charge core-sched forced idle to the DL servers

In reply to Fernand Sieber
The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     f4626e1c3c14306453e89bfc7799bd295f38b402
Gitweb:        https://git.kernel.org/tip/f4626e1c3c14306453e89bfc7799bd295f38b402
Author:        Fernand Sieber <[email protected]>
AuthorDate:    Thu, 12 Nov 2026 18:15:47 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Mon, 23 Nov 2026 10:38:26 +01:00

sched/deadline: Don't charge core-sched forced idle to the DL servers

A deferred DL server is charged the idle time of its rq, on the premise that the time was available to the server's class and went unused. Core scheduling breaks that premise: a CPU is forced idle when a SMT sibling runs a task with an incompatible cookie, so that time was available to no class at all.

update_curr_dl_se() then runs the server's runtime out while it is throttled and calls replenish_dl_new_period(), pushing the activation a full period out. dl_defer_idle does not help, as idle_rq() is false on a forced-idle CPU: nr_running is not 0. Every period of forced idle pushes the activation again, the zero-laxity timer never fires, and the class the server reserves for gets nothing.

Reproduction on 2 cores x 2 threads with the default fair server (50 ms / 1 s): a SCHED_FIFO spinner with a core-sched cookie on CPU0 and an uncookied CFS spinner on CPU1 force-idle CPU1, and the CFS task gets under 0.1% of a CPU instead of the reserved 5%. The ext server starves sched_ext tasks the same way, and there a plain CFS spinner on the sibling is enough.

Don't charge forced idle. A server still only loses runtime to real execution or real idle, and one whose class has nothing to run still stops through dl_defer_idle once the rq is idle for real; with core scheduling off nothing changes. Getting the reserved bandwidth back also needs the server's pick to win the core-wide selection, which the preceding sched/core patches fix.

---
 kernel/sched/idle.c  |  7 +++++++
 kernel/sched/sched.h | 15 +++++++++++++++
 2 files changed, 22 insertions(+)
kernel/sched/idle.c +7 -0
index e0c10a5..717d566 100644
@@ -573,6 +573,13 @@ static void update_curr_idle(struct rq *rq)
 
 	se->exec_start = now;
 
+	/*
+	 * Forced idle was not time available to any class on this rq, so
+	 * don't let the deferred servers consume their runtime on it.
+	 */
+	if (forced_idle_rq(rq))
+		return;
+
 	dl_server_update_idle(&rq->fair_server, delta_exec);
 #ifdef CONFIG_SCHED_CLASS_EXT
 	dl_server_update_idle(&rq->ext_server, delta_exec);
kernel/sched/sched.h +15 -0
index a4e6696..804c703 100644
@@ -1522,6 +1522,16 @@ static inline bool sched_core_disabled(void)
 }
 
 /*
+ * True while core scheduling keeps @rq idle because a SMT sibling runs a task
+ * with an incompatible cookie, even though @rq has runnable tasks of its own.
+ */
+static inline bool forced_idle_rq(struct rq *rq)
+{
+	return sched_core_enabled(rq) && rq->core->core_forceidle_count &&
+	       rq->nr_running;
+}
+
+/*
  * Be careful with this function; not for general use. The return value isn't
  * stable unless you actually hold a relevant rq->__lock.
  */
@@ -1655,6 +1665,11 @@ static inline bool sched_core_disabled(void)
 	return true;
 }
 
+static inline bool forced_idle_rq(struct rq *rq)
+{
+	return false;
+}
+
 static inline raw_spinlock_t *rq_lockp(struct rq *rq)
 {
 	return &rq->__lock;
#13 lore raw

Re: [PATCH 4/5] sched/deadline: Don't charge core-sched forced idle to the DL servers

In reply to Fernand Sieber

kernel/sched/idle.c static void update_curr_idle(struct rq *rq) · line 581

Quoted 6 lines · Fernand Sieber
kernel/sched/idle.c +6 -0
+	/*
+	 * Forced idle was not time available to any class on this rq, so
+	 * don't let the deferred servers consume their runtime on it.
+	 */
+	if (forced_idle_rq(rq))
+		return;

When forced idle ends because the sibling's cookied task blocks, pick_next_task() clears core_forceidle_count before the idle CPU runs update_curr_idle() in put_prev_task_idle().

forced_idle_rq(rq) sees 0 and charges the forced-idle time since idle->se.exec_start to the server.

cs_dl_server_test passes because its FIFO child never blocks.

With a 1000 Hz tick on tip/sched/core c47af8566706 in a 2-core, 2-thread KVM guest, letting the FIFO task spin 800 us and sleep 10 us drops the CFS share from 5.0% to 1.7%.

Thanks,
Karl

#14 lore raw

cover sched/deadline: Fix forced idle charged when a sibling ends it

Karl reported that "sched/deadline: Don't charge core-sched forced idle to the DL servers" (f4626e1c3c14, in sched/urgent) still charges forced idle to the DL servers when the sibling's cookied task blocks: the core pick clears core_forceidle_count before the idle CPU charges the time. With his 800 us spin / 10 us sleep FIFO pattern the CFS task gets 0.8-1.8% instead of its 5% reservation.

Patch 1 makes the core-wide pick charge each idle sibling's idle time under the forced-idle state from before the pick, so that no charged span crosses a change of that state. It adds no new state. Patch 2 adds Karl's pattern to cs_dl_server_test.

Tested on sched/core. QEMU, 2 cores x 2 threads, 8 runs each:
tip/sched/core fails Karl's pattern 8/8; with these patches both tests pass 8/8 (5.0% and 5.6-5.8%). Both patches apply to sched/urgent, where the existing selftest already needs 87a825f3c680 ("sched/core: Rank DL server picks as deadline in the core-wide pick"), as in my earlier mail.

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

Fernand Sieber (2):
sched/deadline: Keep forced idle uncharged when a sibling ends it selftests/sched: Let the FIFO task block in cs_dl_server_test

 kernel/sched/core.c                           |   8 ++
 kernel/sched/idle.c                           |  25 +++-
 kernel/sched/sched.h                          |   1 +
 .../selftests/sched/cs_dl_server_test.c       | 107 +++++++++++-------
 4 files changed, 96 insertions(+), 45 deletions(-)

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

#15 lore raw

PATCH 1/2 sched/deadline: Keep forced idle uncharged when a sibling ends it

Commit f4626e1c3c14 ("sched/deadline: Don't charge core-sched forced idle to the DL servers") keeps forced idle from being charged to the fair and ext servers. But it tests forced_idle_rq() when the idle time is charged, not when the idle task started running. When the sibling ends the forced idle, the test reads false by then and the forced-idle span is charged anyway.

The timeline below describes the issue:

Setup. CPU0 and CPU1 are SMT siblings.
- CPU1 runs R, a SCHED_FIFO task with cookie X, which spins and sleeps briefly in a loop.
- CPU0 has C, a CFS task with no cookie, which only runs through CPU0's fair server.

t0, CPU0 is forced idle. The core cookie is X and CPU0 has no cookie-X task, so CPU0 runs idle. core_forceidle_count is set and idle->se.exec_start is stamped.

t1, R blocks. CPU1 does the core-wide pick. No cookie-X task is left, so forced idle ends: the pick clears core_forceidle_count and picks C for CPU0.

t2, CPU0 switches from idle to C. update_curr_idle() charges the idle time since its last update to the fair and ext servers. forced_idle_rq(rq0) reads false, since t1 cleared the count, so the forced-idle span up to t1 is charged.

t3, result. The fair server spends its runtime on time in which C could not run, and C gets throttled. With R spinning 800us and sleeping 10us (HZ=1000, 2-core 2-thread KVM guest), C gets 0.8-1.8% of the CPU instead of the 5% reservation.

With this patch, the core-wide pick settles the idle time of each idle sibling under the state from before the pick: at t1 it drops CPU0's forced-idle span, and a pick that starts forced idle charges the idle time before it. As only this pick changes core_forceidle_count, forced_idle_rq() then holds for the whole span that update_curr_idle() charges.

With this, C gets 5.6-5.8% in the same setup.

Fixes f4626e1c3c14 ("sched/deadline: Don't charge core-sched forced idle to the DL servers")
---
 kernel/sched/core.c  |  8 ++++++++
 kernel/sched/idle.c  | 25 +++++++++++++++++++------
 kernel/sched/sched.h |  1 +
 3 files changed, 28 insertions(+), 6 deletions(-)
kernel/sched/core.c +8 -0
index ea89471d4743c..825d9bbea3128 100644
@@ -6451,6 +6451,14 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
 		if (i != cpu && (rq_i != rq->core || !core_clock_updated))
 			update_rq_clock(rq_i);
 
+		/*
+		 * This pick can start or end forced idle on rq_i while its
+		 * idle task runs on, and the old state is already reset.
+		 * Charge the idle time so far under the old state.
+		 */
+		if (rq_i->curr == rq_i->idle)
+			charge_idle_to_dl_servers(rq_i, fi_before && rq_i->nr_running);
+
 		p = pick_task(rq_i, rf);
 		if (unlikely(p == RETRY_TASK)) {
 			/* rq lock may have been dropped, clocks invalidated */
kernel/sched/idle.c +19 -6
index 451b4846219d5..0449ccefba6c7 100644
@@ -561,7 +561,14 @@ prio_changed_idle(struct rq *rq, struct task_struct *p, u64 oldprio)
 	BUG();
 }
 
-static void update_curr_idle(struct rq *rq)
+/*
+ * Charge the time the idle task of @rq ran since its se.exec_start to the
+ * fair and ext servers, and advance se.exec_start to now. Nothing is
+ * charged if @span_was_forced_idle: forced idle was not time available to
+ * any class on @rq, so the deferred servers must not consume their runtime
+ * on it.
+ */
+void charge_idle_to_dl_servers(struct rq *rq, bool span_was_forced_idle)
 {
 	struct sched_entity *se = &rq->idle->se;
 	u64 now = rq_clock_task(rq);
@@ -573,11 +580,7 @@ static void update_curr_idle(struct rq *rq)
 
 	se->exec_start = now;
 
-	/*
-	 * Forced idle was not time available to any class on this rq, so
-	 * don't let the deferred servers consume their runtime on it.
-	 */
-	if (forced_idle_rq(rq))
+	if (span_was_forced_idle)
 		return;
 
 	dl_server_update_idle(&rq->fair_server, delta_exec);
@@ -586,6 +589,16 @@ static void update_curr_idle(struct rq *rq)
 #endif
 }
 
+/*
+ * Only the core-wide pick starts or ends forced idle, and it charges the
+ * idle time up to that point under the old state, so the current state is
+ * the state of the whole span here.
+ */
+static void update_curr_idle(struct rq *rq)
+{
+	charge_idle_to_dl_servers(rq, forced_idle_rq(rq));
+}
+
 /*
  * Simple, special scheduling class for the per-CPU idle tasks:
  */
kernel/sched/sched.h +1 -0
index 32f76551a0c5e..1c61a1a9309a0 100644
@@ -3005,6 +3005,7 @@ static inline bool sched_fair_runnable(struct rq *rq)
 
 extern struct task_struct *pick_task_fair(struct rq *rq, struct rq_flags *rf);
 extern struct task_struct *pick_task_idle(struct rq *rq, struct rq_flags *rf);
+void charge_idle_to_dl_servers(struct rq *rq, bool span_was_forced_idle);
 
 #define SCA_CHECK		0x01
 #define SCA_MIGRATE_DISABLE	0x02
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
#16 lore raw

PATCH 2/2 selftests/sched: Let the FIFO task block in cs_dl_server_test

In reply to Fernand Sieber

The FIFO child of cs_dl_server_test never blocks, so forced idle on its sibling only ends through the fair server's pick. The test therefore missed forced idle charged to the fair server when the cookied task blocks and the sibling's core-wide pick ends forced idle.

Run the test a second time with the FIFO child spinning 800us and sleeping 10us, and hold that pass to the same floor of half the fair server's reservation.

---
 .../selftests/sched/cs_dl_server_test.c       | 107 +++++++++++-------
 1 file changed, 68 insertions(+), 39 deletions(-)
tools/testing/selftests/sched/cs_dl_server_test.c +68 -39
index 38aa005080f1f..c085f7059e054 100644
@@ -14,6 +14,10 @@
  * whenever the FIFO task runs, and checks that the CFS task still gets a
  * sensible fraction of the fair server's reservation.
  *
+ * A second pass lets the FIFO task sleep briefly between spins, so forced idle
+ * mostly ends through the core-wide pick made when the FIFO task blocks rather
+ * than through the fair server.
+ *
  * Copyright (c) 2026 Amazon.com, Inc. or its affiliates.
  */
 #define _GNU_SOURCE
@@ -21,6 +25,7 @@
 #include <limits.h>
 #include <sched.h>
 #include <signal.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -48,6 +53,8 @@ enum pid_type {PIDTYPE_PID = 0, PIDTYPE_TGID, PIDTYPE_PGID};
 
 #define RUN_TIME	5	/* measurement window, in seconds */
 #define FIFO_PRIO	50
+#define FIFO_SPIN_US	800	/* blocking pass: spin this long ... */
+#define FIFO_SLEEP_US	10	/* ... then sleep this long */
 
 /*
  * The reservation is only approached, not reached: every slice the fair server
@@ -208,6 +215,20 @@ static double monotonic_now(void)
 	return ts.tv_sec + ts.tv_nsec / 1000000000.0;
 }
 
+/* Spin for FIFO_SPIN_US, then sleep for FIFO_SLEEP_US, until killed. */
+static void spin_sleep_forever(void)
+{
+	struct timespec nap = { .tv_nsec = FIFO_SLEEP_US * 1000 };
+	double until;
+
+	while (1) {
+		until = monotonic_now() + FIFO_SPIN_US / 1000000.0;
+		while (monotonic_now() < until)
+			;
+		nanosleep(&nap, NULL);
+	}
+}
+
 /*
  * Diagnostic only: how long the FIFO task's CPU was forced idle. Needs
  * CONFIG_SCHEDSTATS and schedstats enabled, so it must not gate the result.
@@ -233,7 +254,7 @@ static void print_forced_idle(pid_t pid)
 }
 
 /* Cookied SCHED_FIFO spinner. Only this task gets a cookie. */
-static void fifo_child(int cpu, int ready_fd)
+static void fifo_child(int cpu, int ready_fd, bool blocks)
 {
 	struct sched_param param = { .sched_priority = FIFO_PRIO };
 
@@ -252,6 +273,8 @@ static void fifo_child(int cpu, int ready_fd)
 		signal_status(ready_fd, CHILD_ERROR);
 	}
 	signal_status(ready_fd, CHILD_READY);
+	if (blocks)
+		spin_sleep_forever();
 	spin_forever();
 }
 
@@ -287,45 +310,18 @@ static void kill_child(pid_t *pid)
 	*pid = -1;
 }
 
-int main(void)
+/*
+ * Run the FIFO and CFS spinners for RUN_TIME and check the CFS task's share.
+ * With @blocks the FIFO task sleeps between spins.
+ */
+static void test_forced_idle(int sib0, int sib1, double want, bool blocks)
 {
-	double fifo_runtime, cfs_start, cfs_end, t_start, t_end, share, want;
-	unsigned long long runtime, period;
+	double fifo_runtime, cfs_start, cfs_end, t_start, t_end, share;
 	pid_t fifo_pid = -1, cfs_pid = -1;
 	int fifo_ready[2], cfs_ready[2];
-	unsigned long long cookie;
-	int sib0, sib1;
+	const char *pass = blocks ? " (FIFO task sleeps)" : "";
 	char status;
 
-	ksft_print_header();
-	ksft_set_plan(1);
-
-	if (read_sibling_pair(&sib0, &sib1)) {
-		ksft_test_result_skip("CPU0 has no SMT sibling\n");
-		ksft_finished();
-	}
-	ksft_print_msg("SMT siblings: CPU%d (FIFO) and CPU%d (CFS)\n", sib0, sib1);
-
-	if (prctl(PR_SCHED_CORE, PR_SCHED_CORE_GET, 0, PIDTYPE_PID,
-		  (unsigned long)&cookie)) {
-		ksft_test_result_skip("core scheduling unavailable: %s\n",
-				      strerror(errno));
-		ksft_finished();
-	}
-
-	if (read_fair_server(sib1, &runtime, &period)) {
-		ksft_test_result_skip("cannot read " FAIR_SERVER "/cpu%d, debugfs not mounted?\n",
-				      sib1);
-		ksft_finished();
-	}
-	if (!runtime || !period) {
-		ksft_test_result_skip("fair server on CPU%d is disabled (%llu/%llu)\n",
-				      sib1, runtime, period);
-		ksft_finished();
-	}
-	ksft_print_msg("CPU%d fair server reservation: %llu/%llu ns = %.3f%%\n",
-		       sib1, runtime, period, 100.0 * runtime / period);
-
 	if (pipe(fifo_ready) || pipe(cfs_ready))
 		ksft_exit_fail_perror("pipe");
 
@@ -334,7 +330,7 @@ int main(void)
 		close(fifo_ready[0]);
 		close(cfs_ready[0]);
 		close(cfs_ready[1]);
-		fifo_child(sib0, fifo_ready[1]);
+		fifo_child(sib0, fifo_ready[1], blocks);
 	} else if (fifo_pid < 0) {
 		ksft_exit_fail_perror("fork FIFO child");
 	}
@@ -348,7 +344,7 @@ int main(void)
 		close(cfs_ready[1]);
 		if (status == CHILD_EPERM) {
 			ksft_test_result_skip("need privileges for SCHED_FIFO\n");
-			ksft_finished();
+			return;
 		}
 		ksft_exit_fail_msg("FIFO child setup failed\n");
 	}
@@ -388,7 +384,6 @@ int main(void)
 		ksft_exit_fail_msg("cannot read CLOCK_MONOTONIC\n");
 
 	share = (cfs_end - cfs_start) / (t_end - t_start);
-	want = MIN_SHARE_OF_RESERVATION * runtime / period;
 
 	ksft_print_msg("FIFO task ran %.3fs, CFS task ran %.3fs over %.3fs\n",
 		       fifo_runtime, cfs_end - cfs_start, t_end - t_start);
@@ -396,7 +391,41 @@ int main(void)
 		       sib1, share * 100, want * 100);
 
 	ksft_test_result(share >= want,
-			 "CFS task gets the fair server reservation while forced idle\n");
+			 "CFS task gets the fair server reservation while forced idle%s\n",
+			 pass);
+}
+
+int main(void)
+{
+	unsigned long long runtime, period;
+	unsigned long long cookie;
+	int sib0, sib1;
+	double want;
+
+	ksft_print_header();
+
+	if (read_sibling_pair(&sib0, &sib1))
+		ksft_exit_skip("CPU0 has no SMT sibling\n");
+	ksft_print_msg("SMT siblings: CPU%d (FIFO) and CPU%d (CFS)\n", sib0, sib1);
+
+	if (prctl(PR_SCHED_CORE, PR_SCHED_CORE_GET, 0, PIDTYPE_PID,
+		  (unsigned long)&cookie))
+		ksft_exit_skip("core scheduling unavailable: %s\n",
+			       strerror(errno));
+
+	if (read_fair_server(sib1, &runtime, &period))
+		ksft_exit_skip("cannot read " FAIR_SERVER "/cpu%d, debugfs not mounted?\n",
+			       sib1);
+	if (!runtime || !period)
+		ksft_exit_skip("fair server on CPU%d is disabled (%llu/%llu)\n",
+			       sib1, runtime, period);
+	ksft_print_msg("CPU%d fair server reservation: %llu/%llu ns = %.3f%%\n",
+		       sib1, runtime, period, 100.0 * runtime / period);
+
+	ksft_set_plan(2);
+	want = MIN_SHARE_OF_RESERVATION * runtime / period;
+	test_forced_idle(sib0, sib1, want, false);
+	test_forced_idle(sib0, sib1, want, true);
 
 	ksft_finished();
 }
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
#17 lore raw

PATCH 5/5 selftests/sched: Add a core-sched forced-idle DL server test

In reply to Fernand Sieber

Nothing in selftests notices a deferred DL server that is charged for core-sched forced idle and so never activates: the fair server keeps its reservation in debugfs while the CFS tasks it reserves for get a few hundredths of a percent of a CPU.

Add cs_dl_server_test. It pins a SCHED_FIFO 50 spinner with its own core cookie to one SMT sibling and an uncookied CFS spinner to the other, so the second sibling is forced idle whenever the FIFO task runs, then checks the CFS task's share of that CPU over five seconds against the fair server's reservation under /sys/kernel/debug/sched/. The floor is half the reservation, 2.5% by default, since every slice the server gets costs a forced-idle hand-over. It skips without SMT, without core scheduling, or without the debugfs reservation.

At 2 cores x 2 threads the share measures 4.0-5.2% once both this idle charge and the core-wide DL server pick are fixed, and 0.0% with either missing, so it passes only with both.

---
 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 ++++++++++++++++++
 4 files changed, 408 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/sched/cs_dl_server_test.c
tools/testing/selftests/sched/.gitignore +1 -0
index 6996d4654d924..4e3a0254e0abc 100644
@@ -1 +1,2 @@
 cs_prctl_test
+cs_dl_server_test
tools/testing/selftests/sched/Makefile +2 -2
index 099ee9213557a..fa50d1385bd68 100644
@@ -8,7 +8,7 @@ CFLAGS += -O2 -Wall -g -I./ $(KHDR_INCLUDES) -Wl,-rpath=./ \
 	  $(CLANG_FLAGS)
 LDLIBS += -lpthread
 
-TEST_GEN_FILES := cs_prctl_test
-TEST_PROGS := cs_prctl_test
+TEST_GEN_FILES := cs_prctl_test cs_dl_server_test
+TEST_PROGS := cs_prctl_test cs_dl_server_test
 
 include ../lib.mk
tools/testing/selftests/sched/config +3 -1
index 1bb8bf6d7fd4c..57b2439f75eed 100644
@@ -1 +1,3 @@
-# empty
+CONFIG_SCHED_CORE=y
+CONFIG_SCHED_SMT=y
+CONFIG_DEBUG_FS=y
tools/testing/selftests/sched/cs_dl_server_test.c new file +402 -0

402 lines not on this page · raw message

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
merge bot Applied
#18 lore raw

[tip: sched/urgent] selftests/sched: Add a core-sched forced-idle DL server test

The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     70f43730a814fcf4198960dcff5fadb2fc8b795d
Gitweb:        https://git.kernel.org/tip/70f43730a814fcf4198960dcff5fadb2fc8b795d
Author:        Fernand Sieber <[email protected]>
AuthorDate:    Thu, 12 Nov 2026 18:15:48 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Sun, 22 Nov 2026 16:16:44 +01:00

selftests/sched: Add a core-sched forced-idle DL server test

Nothing in selftests notices a deferred DL server that is charged for core-sched forced idle and so never activates: the fair server keeps its reservation in debugfs while the CFS tasks it reserves for get a few hundredths of a percent of a CPU.

Add cs_dl_server_test. It pins a SCHED_FIFO 50 spinner with its own core cookie to one SMT sibling and an uncookied CFS spinner to the other, so the second sibling is forced idle whenever the FIFO task runs, then checks the CFS task's share of that CPU over five seconds against the fair server's reservation under /sys/kernel/debug/sched/. The floor is half the reservation, 2.5% by default, since every slice the server gets costs a forced-idle hand-over. It skips without SMT, without core scheduling, or without the debugfs reservation.

At 2 cores x 2 threads the share measures 4.0-5.2% once both this idle charge and the core-wide DL server pick are fixed, and 0.0% with either missing, so it passes only with both.

---
 tools/testing/selftests/sched/.gitignore          |   1 +-
 tools/testing/selftests/sched/Makefile            |   4 +-
 tools/testing/selftests/sched/config              |   4 +-
 tools/testing/selftests/sched/cs_dl_server_test.c | 402 +++++++++++++-
 4 files changed, 408 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/sched/cs_dl_server_test.c
tools/testing/selftests/sched/.gitignore +1 -0
index 6996d46..4e3a025 100644
@@ -1 +1,2 @@
 cs_prctl_test
+cs_dl_server_test
tools/testing/selftests/sched/Makefile +2 -2
index 099ee92..fa50d13 100644
@@ -8,7 +8,7 @@ CFLAGS += -O2 -Wall -g -I./ $(KHDR_INCLUDES) -Wl,-rpath=./ \
 	  $(CLANG_FLAGS)
 LDLIBS += -lpthread
 
-TEST_GEN_FILES := cs_prctl_test
-TEST_PROGS := cs_prctl_test
+TEST_GEN_FILES := cs_prctl_test cs_dl_server_test
+TEST_PROGS := cs_prctl_test cs_dl_server_test
 
 include ../lib.mk
tools/testing/selftests/sched/config +3 -1
index 1bb8bf6..57b2439 100644
@@ -1 +1,3 @@
-# empty
+CONFIG_SCHED_CORE=y
+CONFIG_SCHED_SMT=y
+CONFIG_DEBUG_FS=y
tools/testing/selftests/sched/cs_dl_server_test.c new file +402 -0

402 lines not on this page · raw message

#19 lore raw

Re: [tip: sched/urgent] selftests/sched: Add a core-sched forced-idle DL server test

Hi Peter,

Thanks for picking these up. I think there's an issue with the split:
sched/urgent has the two fixes and the new selftest:

d2583cb03113 ("sched/deadline: Clear stale rq->dl_server when core-sched replaces a pick") f4626e1c3c14 ("sched/deadline: Don't charge core-sched forced idle to the DL servers") 6d6fca38f51f ("selftests/sched: Add a core-sched forced-idle DL server test")

but the ranking patch went to sched/core:

87a825f3c680 ("sched/core: Rank DL server picks as deadline in the core-wide pick")
https://lore.kernel.org/all/179542773720.92412.4774760214632371644.tip-bot2@tip-bot2/

Without it the selftest fails on sched/urgent (8/8 in QEMU, the CFS task gets 0-1% against the 2.5% floor), and passes with it.

Could you move 87a825f3c680 to sched/urgent too? If you would rather keep it for the merge window, the selftest should go to sched/core with it.

Thanks,
Fernand

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

merge bot Applied
#20 lore raw

[tip: sched/urgent] selftests/sched: Add a core-sched forced-idle DL server test

In reply to Fernand Sieber
The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     6d6fca38f51f414b75201d07b9ad4003f714551e
Gitweb:        https://git.kernel.org/tip/6d6fca38f51f414b75201d07b9ad4003f714551e
Author:        Fernand Sieber <[email protected]>
AuthorDate:    Thu, 12 Nov 2026 18:15:48 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Mon, 23 Nov 2026 10:38:26 +01:00

selftests/sched: Add a core-sched forced-idle DL server test

Nothing in selftests notices a deferred DL server that is charged for core-sched forced idle and so never activates: the fair server keeps its reservation in debugfs while the CFS tasks it reserves for get a few hundredths of a percent of a CPU.

Add cs_dl_server_test. It pins a SCHED_FIFO 50 spinner with its own core cookie to one SMT sibling and an uncookied CFS spinner to the other, so the second sibling is forced idle whenever the FIFO task runs, then checks the CFS task's share of that CPU over five seconds against the fair server's reservation under /sys/kernel/debug/sched/. The floor is half the reservation, 2.5% by default, since every slice the server gets costs a forced-idle hand-over. It skips without SMT, without core scheduling, or without the debugfs reservation.

At 2 cores x 2 threads the share measures 4.0-5.2% once both this idle charge and the core-wide DL server pick are fixed, and 0.0% with either missing, so it passes only with both.

---
 tools/testing/selftests/sched/.gitignore          |   1 +-
 tools/testing/selftests/sched/Makefile            |   4 +-
 tools/testing/selftests/sched/config              |   4 +-
 tools/testing/selftests/sched/cs_dl_server_test.c | 402 +++++++++++++-
 4 files changed, 408 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/sched/cs_dl_server_test.c
tools/testing/selftests/sched/.gitignore +1 -0
index 6996d46..4e3a025 100644
@@ -1 +1,2 @@
 cs_prctl_test
+cs_dl_server_test
tools/testing/selftests/sched/Makefile +2 -2
index 099ee92..fa50d13 100644
@@ -8,7 +8,7 @@ CFLAGS += -O2 -Wall -g -I./ $(KHDR_INCLUDES) -Wl,-rpath=./ \
 	  $(CLANG_FLAGS)
 LDLIBS += -lpthread
 
-TEST_GEN_FILES := cs_prctl_test
-TEST_PROGS := cs_prctl_test
+TEST_GEN_FILES := cs_prctl_test cs_dl_server_test
+TEST_PROGS := cs_prctl_test cs_dl_server_test
 
 include ../lib.mk
tools/testing/selftests/sched/config +3 -1
index 1bb8bf6..57b2439 100644
@@ -1 +1,3 @@
-# empty
+CONFIG_SCHED_CORE=y
+CONFIG_SCHED_SMT=y
+CONFIG_DEBUG_FS=y
tools/testing/selftests/sched/cs_dl_server_test.c new file +402 -0

402 lines not on this page · raw message