From: Zhao Mengmeng <zhaomzhao@126.com>
To: tj@kernel.org, void@manifault.com, arighi@nvidia.com,
changwoo@igalia.com
Cc: sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org,
zhaomengmeng@kylinos.cn
Subject: [PATCH 2/2] sched_ext: Print sub-scheduler disabled log and reason
Date: Wed, 15 Apr 2026 17:54:18 +0800 [thread overview]
Message-ID: <20260415095418.307555-3-zhaomzhao@126.com> (raw)
In-Reply-To: <20260415095418.307555-1-zhaomzhao@126.com>
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 dettached, 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>
---
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
prev parent reply other threads:[~2026-04-15 9:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 9:54 [PATCH 0/2] sched_ext: Cgroup sub-scheduler minor fixes Zhao Mengmeng
2026-04-15 9:54 ` [PATCH 1/2] tools/sched_ext: Add missing -c option in scx_qmap help Zhao Mengmeng
2026-04-15 10:46 ` Cheng-Yang Chou
2026-04-15 10:48 ` Zhao mengmeng
2026-04-15 9:54 ` Zhao Mengmeng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260415095418.307555-3-zhaomzhao@126.com \
--to=zhaomzhao@126.com \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=void@manifault.com \
--cc=zhaomengmeng@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®