All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cheng-Yang Chou <yphbchou0911@gmail.com>
To: sched-ext@lists.linux.dev, Tejun Heo <tj@kernel.org>,
	David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>
Cc: Ching-Chun Huang <jserv@ccns.ncku.edu.tw>,
	Chia-Ping Tsai <chia7712@gmail.com>,
	yphbchou0911@gmail.com
Subject: [PATCH] sched_ext: Fix scx_bpf_dsq_move_to_local___v2() to handle SCX_DSQ_GLOBAL
Date: Thu, 26 Mar 2026 17:17:30 +0800	[thread overview]
Message-ID: <20260326091756.816828-1-yphbchou0911@gmail.com> (raw)

scx_bpf_dsq_move_to_local___v2() called find_user_dsq() for all dsq_id
values, but find_user_dsq() only searches the rhashtable of user-created
DSQs. SCX_DSQ_GLOBAL is a builtin DSQ stored in the per-node pnode and
not in the rhashtable, so passing SCX_DSQ_GLOBAL caused find_user_dsq()
to return NULL, triggering scx_error() and aborting the scheduler.

Add an explicit check for SCX_DSQ_GLOBAL and use find_global_dsq() in
that case, matching the pattern used in find_dsq_for_dispatch().

Fixes: 860683763ebf ("sched_ext: Add enq_flags to scx_bpf_dsq_move_to_local()")
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
---
 kernel/sched/ext.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 551bfb99157d..0d0780c77ffd 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -8249,7 +8249,10 @@ __bpf_kfunc bool scx_bpf_dsq_move_to_local___v2(u64 dsq_id, u64 enq_flags,
 
 	flush_dispatch_buf(sch, dspc->rq);
 
-	dsq = find_user_dsq(sch, dsq_id);
+	if (dsq_id == SCX_DSQ_GLOBAL)
+		dsq = find_global_dsq(sch, cpu_of(dspc->rq));
+	else
+		dsq = find_user_dsq(sch, dsq_id);
 	if (unlikely(!dsq)) {
 		scx_error(sch, "invalid DSQ ID 0x%016llx", dsq_id);
 		return false;
-- 
2.48.1


             reply	other threads:[~2026-03-26  9:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26  9:17 Cheng-Yang Chou [this message]
2026-03-26 11:22 ` [PATCH] sched_ext: Fix scx_bpf_dsq_move_to_local___v2() to handle SCX_DSQ_GLOBAL Tejun Heo
2026-03-26 14:24   ` Cheng-Yang Chou
2026-03-26 19:46     ` Tejun Heo
2026-03-26 19:47       ` 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=20260326091756.816828-1-yphbchou0911@gmail.com \
    --to=yphbchou0911@gmail.com \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=chia7712@gmail.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=sched-ext@lists.linux.dev \
    --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.