Skip to contentSkip to conversation

sched/debug: Print slice length for fair tasks

PATCH Applied Christian Loehle 2 participants 3 messages Jan 29, 2025 – Jan 31, 2025 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/debug: Print slice length for fair tasks

With commit 857b158dc5e8 ("sched/eevdf: Use sched_attr::sched_runtime to set request/slice suggestion") we have the userspace per-task tunable slice length so print it in /proc/$PID/sched.

---
 kernel/sched/debug.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/sched/debug.c +2 -0
index fd7e85220715..ef047add7f9e 100644
@@ -1262,6 +1262,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
 	if (task_has_dl_policy(p)) {
 		P(dl.runtime);
 		P(dl.deadline);
+	} else if (fair_policy(p->policy)) {
+		P(se.slice);
 	}
 #ifdef CONFIG_SCHED_CLASS_EXT
 	__PS("ext.enabled", task_on_scx(p));
Signature · 1 line
2.34.1
#1 lore raw
Quoted 14 lines · Christian Loehle

With commit 857b158dc5e8 ("sched/eevdf: Use sched_attr::sched_runtime to set request/slice suggestion") we have the userspace per-task tunable slice length so print it in /proc/$PID/sched.

---
 kernel/sched/debug.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/sched/debug.c +0 -0
index fd7e85220715..ef047add7f9e 100644

kernel/sched/debug.c void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns, · line 1269

Quoted 8 lines
kernel/sched/debug.c +2 -0
@@ -1262,6 +1262,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
 	if (task_has_dl_policy(p)) {
 		P(dl.runtime);
 		P(dl.deadline);
+	} else if (fair_policy(p->policy)) {
+		P(se.slice);
 	}
 #ifdef CONFIG_SCHED_CLASS_EXT
 	__PS("ext.enabled", task_on_scx(p));

So Peter added a debug slice length print for all tasks on the rq in commit ("147f3efaa241 sched/fair: Implement an EEVDF-like scheduling policy") already, but that alone is a bit awkward to play with when modifying slice length for specific tasks which aren't always enqueued.

#2 lore raw

[tip: sched/urgent] sched/debug: Provide slice length for fair tasks

In reply to Christian Loehle
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:     9065ce69754dece78606c8bbb3821449272e56bf
Gitweb:        https://git.kernel.org/tip/9065ce69754dece78606c8bbb3821449272e56bf
Author:        Christian Loehle <[email protected]>
AuthorDate:    Wed, 29 Jan 2025 17:59:44 
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Fri, 31 Jan 2025 10:45:33 +01:00

sched/debug: Provide slice length for fair tasks

Since commit:

857b158dc5e8 ("sched/eevdf: Use sched_attr::sched_runtime to set request/slice suggestion")

... we have the userspace per-task tunable slice length, which is a key parameter that is otherwise difficult to obtain, so provide it in /proc/$PID/sched.

[ mingo: Clarified the changelog. ]

---
 kernel/sched/debug.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/sched/debug.c +2 -0
index a1be00a..5b32d3c 100644
@@ -1265,6 +1265,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
 	if (task_has_dl_policy(p)) {
 		P(dl.runtime);
 		P(dl.deadline);
+	} else if (fair_policy(p->policy)) {
+		P(se.slice);
 	}
 #ifdef CONFIG_SCHED_CLASS_EXT
 	__PS("ext.enabled", task_on_scx(p));