From: David Carlier <devnexen@gmail.com>
To: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>
Cc: linux-kernel@vger.kernel.org, David Carlier <devnexen@gmail.com>
Subject: [PATCH] sched_ext: add unlikely() hints in do_enqueue_task() hot path
Date: Thu, 26 Feb 2026 22:44:25 +0000 [thread overview]
Message-ID: <20260226224425.8819-1-devnexen@gmail.com> (raw)
Add unlikely() branch hints to the scx_rq_online() and
scx_rq_bypassing() checks in do_enqueue_task() that are rarely taken
during normal operation.
The PF_EXITING and migration_disabled checks are left unchanged as the
existing code already places unlikely() precisely on the runtime
condition.
Signed-off-by: David Carlier <devnexen@gmail.com>
---
kernel/sched/ext.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index c18e81e8ef51..9a888ce5e2f1 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -1360,10 +1360,10 @@ static void do_enqueue_task(struct rq *rq, struct task_struct *p, u64 enq_flags,
* is offline and are just running the hotplug path. Don't bother the
* BPF scheduler.
*/
- if (!scx_rq_online(rq))
+ if (unlikely(!scx_rq_online(rq)))
goto local;
- if (scx_rq_bypassing(rq)) {
+ if (unlikely(scx_rq_bypassing(rq))) {
__scx_add_event(sch, SCX_EV_BYPASS_DISPATCH, 1);
goto bypass;
}
--
2.51.0
next reply other threads:[~2026-02-26 22:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 22:44 David Carlier [this message]
2026-02-27 17:30 ` [PATCH] sched_ext: add unlikely() hints in do_enqueue_task() hot path Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2026-02-26 17:50 David Carlier
2026-02-26 22:08 ` Tejun Heo
2026-02-27 17:40 ` David CARLIER
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=20260226224425.8819-1-devnexen@gmail.com \
--to=devnexen@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--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.