From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>
Cc: Emil Tsalapatis <etsal@meta.com>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCHSET sched_ext/for-7.4] sched_ext: Add lazy preemption support
Date: Fri, 11 Sep 2026 21:56:52 +0200 [thread overview]
Message-ID: <20260911195800.974364-1-arighi@nvidia.com> (raw)
The fair scheduling class can defer a scheduling boundary through lazy
rescheduling, but sched_ext currently exposes only immediate preemption to BPF
schedulers.
The series adds lazy variants of the enqueue and kick preemption flags. They
expire the running sched_ext task's slice while allowing the scheduling boundary
to be deferred until a return to user space or the next scheduler tick.
Non-local lazy enqueue requests retain the head-insertion semantics of immediate
preemption.
SCX_OPS_LAZY_SLICE_EXPIRY also lets a BPF scheduler request lazy rescheduling
when a slice expires in task_tick_scx(), matching the choice available to the
fair scheduling class. Immediate behavior remains the default and is used while
sched_ext is being disabled.
An fexit probe on __resched_curr() records the exact reschedule TIF after the
running task's slice is expired. Together with the stopping callback, the
selftests cover immediate and lazy kicks, coalescing in both orders, tick-driven
slice expiry and invalid flag combinations. Individual modes are skipped when
the running kernel does not expose the corresponding flag.
Andrea Righi (2):
sched_ext: Add lazy preemption support
selftests/sched_ext: Add kick selftest
kernel/sched/ext/ext.c | 115 ++++--
kernel/sched/ext/internal.h | 36 +-
kernel/sched/ext/sub.c | 15 +-
tools/sched_ext/include/scx/enum_defs.autogen.h | 3 +
tools/sched_ext/include/scx/enums.autogen.bpf.h | 6 +
tools/sched_ext/include/scx/enums.autogen.h | 2 +
tools/sched_ext/include/scx/enums_abi.autogen.h | 5 +-
tools/testing/selftests/sched_ext/Makefile | 1 +
tools/testing/selftests/sched_ext/kick.bpf.c | 144 +++++++
tools/testing/selftests/sched_ext/kick.c | 479 ++++++++++++++++++++++++
10 files changed, 773 insertions(+), 33 deletions(-)
create mode 100644 tools/testing/selftests/sched_ext/kick.bpf.c
create mode 100644 tools/testing/selftests/sched_ext/kick.c
next reply other threads:[~2026-09-11 19:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 19:56 Andrea Righi [this message]
2026-09-11 19:56 ` [PATCH 1/2] " Andrea Righi
2026-09-13 16:50 ` Tejun Heo
2026-09-14 6:05 ` Andrea Righi
2026-09-11 19:56 ` [PATCH 2/2] selftests/sched_ext: Add kick selftest Andrea Righi
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=20260911195800.974364-1-arighi@nvidia.com \
--to=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=etsal@meta.com \
--cc=linux-kernel@vger.kernel.org \
--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 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®