* [PATCH v3 0/2] sched_ext: Cgroup sub-scheduler minor fixes
@ 2026-04-17 9:18 Zhao Mengmeng
2026-04-17 9:18 ` [PATCH v3 1/2] tools/sched_ext: Add missing -c option in scx_qmap help Zhao Mengmeng
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Zhao Mengmeng @ 2026-04-17 9:18 UTC (permalink / raw)
To: Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
Cc: sched-ext, linux-kernel, Zhao Mengmeng, Cheng-Yang Chou
This patchset contains two fixes that I met when testing cgroup
sub-scheduler. Patch 1 add the -c option to scx_qmap help, which support
sub-scheduler but has no clue how to use it. Patch 2 add logs when sub-
scheduler is disabled, almost the same logic as root scheduler.
V3:
- Commit msg nit fix (Cheng-Yang Chou)
- Rebase on sched_ext/for_next(1d2c5353152d)
V2:
- Add [-c CG_PATH] to the usage synopsis(Cheng-Yang Chou)
---
Zhao Mengmeng (2):
tools/sched_ext: Add missing -c option in scx_qmap help
sched_ext: Print sub-scheduler disabled log and reason
kernel/sched/ext.c | 39 ++++++++++++++++++++++++---------------
tools/sched_ext/scx_qmap.c | 4 +++-
2 files changed, 27 insertions(+), 16 deletions(-)
---
base-commit: 1d2c5353152d2e937a24b08261591c198996d13d
change-id: 20260417-sched_ext-0417-bcbc3d992a9a
Best regards,
--
Zhao Mengmeng <zhaomengmeng@kylinos.cn>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 1/2] tools/sched_ext: Add missing -c option in scx_qmap help
2026-04-17 9:18 [PATCH v3 0/2] sched_ext: Cgroup sub-scheduler minor fixes Zhao Mengmeng
@ 2026-04-17 9:18 ` Zhao Mengmeng
2026-04-17 9:18 ` [PATCH v3 2/2] sched_ext: Print sub-scheduler disabled log and reason Zhao Mengmeng
2026-04-17 18:38 ` [PATCH v3 0/2] sched_ext: Cgroup sub-scheduler minor fixes Tejun Heo
2 siblings, 0 replies; 4+ messages in thread
From: Zhao Mengmeng @ 2026-04-17 9:18 UTC (permalink / raw)
To: Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
Cc: sched-ext, linux-kernel, Zhao Mengmeng, Cheng-Yang Chou
From: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
The sub-scheduler api has been added to scx_qmap, but the new -c option is
missing in help, which is hard to understand and use. Add it in help.
V2: add [-c CG_PATH] to the usage synopsis.
Signed-off-by: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
Reviewed-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
---
tools/sched_ext/scx_qmap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/sched_ext/scx_qmap.c b/tools/sched_ext/scx_qmap.c
index 4bdcc4bc5fbd..725c4880058d 100644
--- a/tools/sched_ext/scx_qmap.c
+++ b/tools/sched_ext/scx_qmap.c
@@ -23,7 +23,8 @@ const char help_fmt[] =
"See the top-level comment in .bpf.c for more details.\n"
"\n"
"Usage: %s [-s SLICE_US] [-e COUNT] [-t COUNT] [-T COUNT] [-l COUNT] [-b COUNT]\n"
-" [-N COUNT] [-P] [-M] [-H] [-d PID] [-D LEN] [-S] [-p] [-I] [-F COUNT] [-v]\n"
+" [-N COUNT] [-P] [-M] [-H] [-c CG_PATH] [-d PID] [-D LEN] [-S] [-p] [-I]\n"
+" [-F COUNT] [-v]\n"
"\n"
" -s SLICE_US Override slice duration\n"
" -e COUNT Trigger scx_bpf_error() after COUNT enqueues\n"
@@ -35,6 +36,7 @@ const char help_fmt[] =
" -P Print out DSQ content and event counters to trace_pipe every second\n"
" -M Print out debug messages to trace_pipe\n"
" -H Boost nice -20 tasks in SHARED_DSQ, use with -b\n"
+" -c CG_PATH Cgroup path to attach as sub-scheduler, must run parent scheduler first\n"
" -d PID Disallow a process from switching into SCHED_EXT (-1 for self)\n"
" -D LEN Set scx_exit_info.dump buffer length\n"
" -S Suppress qmap-specific debug dump\n"
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 2/2] sched_ext: Print sub-scheduler disabled log and reason
2026-04-17 9:18 [PATCH v3 0/2] sched_ext: Cgroup sub-scheduler minor fixes Zhao Mengmeng
2026-04-17 9:18 ` [PATCH v3 1/2] tools/sched_ext: Add missing -c option in scx_qmap help Zhao Mengmeng
@ 2026-04-17 9:18 ` Zhao Mengmeng
2026-04-17 18:38 ` [PATCH v3 0/2] sched_ext: Cgroup sub-scheduler minor fixes Tejun Heo
2 siblings, 0 replies; 4+ messages in thread
From: Zhao Mengmeng @ 2026-04-17 9:18 UTC (permalink / raw)
To: Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
Cc: sched-ext, linux-kernel, Zhao Mengmeng, Cheng-Yang Chou
From: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
Take scx_qmap for example, when sub scheduler is attached, there is
'BPF sub-scheduler "qmap" enabled' message, but when detached, the log
is missing. Add a new function to do the log thing, it can be used by
both root scheduler and sub scheduler.
Signed-off-by: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
Reviewed-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
---
kernel/sched/ext.c | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 012ca8bd70fb..229a82900e8f 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -5526,6 +5526,26 @@ static void scx_disable_dump(struct scx_sched *sch)
sch->dump_disabled = true;
}
+static void scx_log_sched_disable(struct scx_sched *sch)
+{
+ struct scx_exit_info *ei = sch->exit_info;
+ const char *type = scx_parent(sch) ? "sub-scheduler" : "scheduler";
+
+ if (ei->kind >= SCX_EXIT_ERROR) {
+ pr_err("sched_ext: BPF %s \"%s\" disabled (%s)\n", type,
+ sch->ops.name, ei->reason);
+
+ if (ei->msg[0] != '\0')
+ pr_err("sched_ext: %s: %s\n", sch->ops.name, ei->msg);
+#ifdef CONFIG_STACKTRACE
+ stack_trace_print(ei->bt, ei->bt_len, 2);
+#endif
+ } else {
+ pr_info("sched_ext: BPF %s \"%s\" disabled (%s)\n", type,
+ sch->ops.name, ei->reason);
+ }
+}
+
#ifdef CONFIG_EXT_SUB_SCHED
static DECLARE_WAIT_QUEUE_HEAD(scx_unlink_waitq);
@@ -5696,6 +5716,8 @@ static void scx_sub_disable(struct scx_sched *sch)
&sub_detach_args);
}
+ scx_log_sched_disable(sch);
+
if (sch->ops.exit)
SCX_CALL_OP(sch, exit, NULL, sch->exit_info);
kobject_del(&sch->kobj);
@@ -5707,7 +5729,6 @@ static void scx_sub_disable(struct scx_sched *sch) { }
static void scx_root_disable(struct scx_sched *sch)
{
- struct scx_exit_info *ei = sch->exit_info;
struct scx_task_iter sti;
struct task_struct *p;
int cpu;
@@ -5797,22 +5818,10 @@ static void scx_root_disable(struct scx_sched *sch)
scx_idle_disable();
synchronize_rcu();
- if (ei->kind >= SCX_EXIT_ERROR) {
- pr_err("sched_ext: BPF scheduler \"%s\" disabled (%s)\n",
- sch->ops.name, ei->reason);
-
- if (ei->msg[0] != '\0')
- pr_err("sched_ext: %s: %s\n", sch->ops.name, ei->msg);
-#ifdef CONFIG_STACKTRACE
- stack_trace_print(ei->bt, ei->bt_len, 2);
-#endif
- } else {
- pr_info("sched_ext: BPF scheduler \"%s\" disabled (%s)\n",
- sch->ops.name, ei->reason);
- }
+ scx_log_sched_disable(sch);
if (sch->ops.exit)
- SCX_CALL_OP(sch, exit, NULL, ei);
+ SCX_CALL_OP(sch, exit, NULL, sch->exit_info);
scx_unlink_sched(sch);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 0/2] sched_ext: Cgroup sub-scheduler minor fixes
2026-04-17 9:18 [PATCH v3 0/2] sched_ext: Cgroup sub-scheduler minor fixes Zhao Mengmeng
2026-04-17 9:18 ` [PATCH v3 1/2] tools/sched_ext: Add missing -c option in scx_qmap help Zhao Mengmeng
2026-04-17 9:18 ` [PATCH v3 2/2] sched_ext: Print sub-scheduler disabled log and reason Zhao Mengmeng
@ 2026-04-17 18:38 ` Tejun Heo
2 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2026-04-17 18:38 UTC (permalink / raw)
To: Zhao Mengmeng
Cc: David Vernet, Andrea Righi, Changwoo Min, sched-ext, linux-kernel,
Zhao Mengmeng, Cheng-Yang Chou
Hello,
> Zhao Mengmeng (2):
> tools/sched_ext: Add missing -c option in scx_qmap help
> sched_ext: Print sub-scheduler disabled log and reason
Applied to sched_ext/for-7.2.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-17 18:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-17 9:18 [PATCH v3 0/2] sched_ext: Cgroup sub-scheduler minor fixes Zhao Mengmeng
2026-04-17 9:18 ` [PATCH v3 1/2] tools/sched_ext: Add missing -c option in scx_qmap help Zhao Mengmeng
2026-04-17 9:18 ` [PATCH v3 2/2] sched_ext: Print sub-scheduler disabled log and reason Zhao Mengmeng
2026-04-17 18:38 ` [PATCH v3 0/2] sched_ext: Cgroup sub-scheduler minor fixes Tejun Heo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.