From: zhidao su <soolaugust@gmail.com>
To: sched-ext@lists.linux.dev
Cc: linux-kernel@vger.kernel.org, tj@kernel.org, arighi@nvidia.com
Subject: [DISCUSSION] SCX_OPS_ALWAYS_ENQ_IMMED semantics clarification
Date: Wed, 25 Mar 2026 15:39:20 +0800 [thread overview]
Message-ID: <20260325073920.758426-1-suzhidao@xiaomi.com> (raw)
Hi Tejun and all,
I'm working on understanding the sched_ext enqueue flow and noticed a
potential documentation gap regarding SCX_OPS_ALWAYS_ENQ_IMMED that I'd
like to clarify.
**Background:**
The flag comment in ext_internal.h L186-188 states:
"If set, %SCX_ENQ_IMMED is assumed to be set on all local DSQ enqueues."
However, reviewing the implementation:
- The SCX_ENQ_IMMED injection happens only in scx_vet_enq_flags() L7812,
which is called exclusively from BPF kfunc paths
(scx_bpf_dsq_insert/scx_bpf_dsq_move_to_local).
- Kernel-side enqueues via do_enqueue_task() that take the `goto local`
path (L1883-1893) bypass scx_vet_enq_flags() entirely.
This means exiting and migration-disabled tasks using the kernel-side
goto local path don't get SCX_ENQ_IMMED injected, and consequently
don't get SCX_TASK_IMMED set in dsq_inc_nr().
The code comment at L1859-1862 acknowledges this:
"exiting and migration-disabled tasks that skip ops.enqueue() below
will lose IMMED protection unless SCX_OPS_ENQ_EXITING /
SCX_OPS_ENQ_MIGRATION_DISABLED are set."
**Questions:**
1. Is this behavior intentional? Should "all local DSQ enqueues" in the
flag documentation be understood as "all BPF-path local DSQ enqueues"?
2. Should the flag documentation be updated to clarify this exception?
3. Or is the current behavior a gap that should be fixed by applying
ALWAYS_ENQ_IMMED semantics uniformly to kernel-side goto local paths
as well?
This would help clarify whether schedulers setting this flag can assume
truly all local enqueues get IMMED protection, or only those through
the BPF interface.
Thanks,
zhidao su
next reply other threads:[~2026-03-25 7:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 7:39 zhidao su [this message]
2026-03-25 15:55 ` 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=20260325073920.758426-1-suzhidao@xiaomi.com \
--to=soolaugust@gmail.com \
--cc=arighi@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
/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®