From: Tejun Heo <tj@kernel.org>
To: void@manifault.com, arighi@nvidia.com, multics69@gmail.com
Cc: linux-kernel@vger.kernel.org, sched-ext@meta.com,
Tejun Heo <tj@kernel.org>
Subject: [PATCH 2/4] sched_ext: Keep bypass on between enable failure and scx_disable_workfn()
Date: Tue, 2 Sep 2025 13:48:04 -1000 [thread overview]
Message-ID: <20250902234817.279206-3-tj@kernel.org> (raw)
In-Reply-To: <20250902234817.279206-1-tj@kernel.org>
scx_enable() turns on the bypass mode while enable is in progress. If
enabling fails, it turns off the bypass mode and then triggers scx_error().
scx_error() will trigger scx_disable_workfn() which will turn on the bypass
mode again and unload the failed scheduler.
This moves the system out of bypass mode between the enable error path and
the disable path, which is unnecessary and can be brittle - e.g. the thread
running scx_enable() may already be on the failed scheduler and can be
switched out before it triggers scx_error() leading to a stall. The watchdog
would eventually kick in, so the situation isn't critical but is still
suboptimal.
There is nothing to be gained by turning off the bypass mode between
scx_enable() failure and scx_disable_workfn(). Keep bypass on.
Signed-off-by: Tejun Heo <tj@kernel.org>
---
kernel/sched/ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 7f799345c899..fda2b4e85ee3 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -5794,7 +5794,7 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link)
err_disable_unlock_all:
scx_cgroup_unlock();
percpu_up_write(&scx_fork_rwsem);
- scx_bypass(false);
+ /* we'll soon enter disable path, keep bypass on */
err_disable:
mutex_unlock(&scx_enable_mutex);
/*
--
2.51.0
next prev parent reply other threads:[~2025-09-02 23:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 23:48 [PATCHSET sched_ext/for-6.18] sched_ext: Misc changes Tejun Heo
2025-09-02 23:48 ` [PATCH 1/4] sched_ext: Make explicit scx_task_iter_relock() calls unnecessary Tejun Heo
2025-09-02 23:48 ` Tejun Heo [this message]
2025-09-02 23:48 ` [PATCH 3/4] sched_ext: Move internal type and accessor definitions to ext_internal.h Tejun Heo
2025-09-03 10:32 ` Andrea Righi
2025-09-03 17:00 ` Tejun Heo
2025-09-03 20:52 ` Andrea Righi
2025-09-02 23:48 ` [PATCH 4/4] sched_ext: Put event_stats_cpu in struct scx_sched_pcpu Tejun Heo
2025-09-03 21:34 ` [PATCHSET sched_ext/for-6.18] sched_ext: Misc changes Tejun Heo
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=20250902234817.279206-3-tj@kernel.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=multics69@gmail.com \
--cc=sched-ext@meta.com \
--cc=void@manifault.com \
/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 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.