PATCHHemanth Selam2026/09/07 14:50

[PATCH 2/2] tools/sched_ext: fix repeated word 'be' in comment

changed diff --git a/tools/sched_ext/include/scx/common.bpf.h b/tools/sched_ext/include/scx/common.bpf.h index 76f5e025e107..9660b43d612c 100644 --- a/tools/sched_ext/include/scx/common.bpf.h +++ b/tools/sched_ext/include/scx/common.bpf.h @@ -306,7 +306,7 @@ BPF_PROG(name, ##args) - * size but is intended to be be resi...

PATCHHemanth Selam2026/09/07 14:49

[PATCH 1/2] sched: fix typo "upto" in comments

changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 713aa26b2828..721f0b3c5c07 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -5840,7 +5840,7 @@ static void bypass_lb_node(struct scx_sched *sch, int node) - * balancing to fill donee CPUs upto $nr_target. Once targets are + * ...

PATCHHemanth Selam2026/09/07 14:49

[PATCH 0/2] sched: fix typos and repeated words in comments

This corrects 2 misspellings and repeated words in comments. Each is a separate patch so that any one of them can be dropped without touching the rest. Nothing outside comments changes. Every touched C file was checked by dropping its comments, replacing each string literal with a placeholder and collapsing whitespace;...

PATCHTianyi Chen2026/09/06 22:41

[PATCH] selftests/sched_ext: Cover duplicate DSQ creation and ID reuse

https://lore.kernel.org/all/Z-OZ7tJWhRZbUk1l@gpd3/ changed diff --git a/tools/testing/selftests/sched_ext/create_dsq.bpf.c b/tools/testing/selftests/sched_ext/create_dsq.bpf.c index 2cfc4ffd60e..680cc4b6d8c 100644 --- a/tools/testing/selftests/sched_ext/create_dsq.bpf.c +++ b/tools/testing/selftests/sched_ext/create_ds...

PATCHTianyi Chen2026/09/06 22:40

[PATCH] selftests/sched_ext: Validate select_cpu_and mask constraints

changed diff --git a/tools/testing/selftests/sched_ext/allowed_cpus.bpf.c b/tools/testing/selftests/sched_ext/allowed_cpus.bpf.c index 9dd72d0da29..08c2fe0e1c3 100644 --- a/tools/testing/selftests/sched_ext/allowed_cpus.bpf.c +++ b/tools/testing/selftests/sched_ext/allowed_cpus.bpf.c @@ -147,23 +147,41 @@ void BPF_STRU...

PATCHTianyi Chen2026/09/06 22:16

[PATCH] selftests/sched_ext: Fail interrupted test runs

changed diff --git a/tools/testing/selftests/sched_ext/runner.c b/tools/testing/selftests/sched_ext/runner.c index c264807caa9..57dda75384f 100644 --- a/tools/testing/selftests/sched_ext/runner.c +++ b/tools/testing/selftests/sched_ext/runner.c @@ -243,7 +243,7 @@ int main(int argc, char **argv) - return failed > 0 ? 1...

PATCHTianyi Chen2026/09/06 21:56

[PATCH] selftests/sched_ext: Handle CPU hotplug write failures

changed diff --git a/tools/testing/selftests/sched_ext/hotplug.c b/tools/testing/selftests/sched_ext/hotplug.c index 0cfbb111a2d..10b8d42bd89 100644 --- a/tools/testing/selftests/sched_ext/hotplug.c +++ b/tools/testing/selftests/sched_ext/hotplug.c @@ -21,15 +21,17 @@ static bool is_cpu_online(void) -static void toggle...

PATCHTejun Heo2026/09/06 06:53

[PATCH sched_ext/for-7.3-fixes] sched_ext: scx_qmap: Fix pending partition work handoff

changed qmap can leave partition work pending with no runner. The effective-cap callback publishes its request after failing to acquire part_busy, while redistribute() checks for pending work before releasing it. Either ordering can miss a request arriving as the current runner finishes, delaying the update until the r...

PATCHTejun Heo2026/09/06 00:10

[PATCH sched_ext/for-7.3-fixes 1/4] sched_ext: Rename sch to root_sch in dispatch_one()

changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 7e414a7c53fc..120540cdda74 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -2919,7 +2919,7 @@ static inline void maybe_queue_balance_callback(struct rq *rq) - struct scx_sched *sch = scx_root_protected_live(); + struct scx_sc...

回复Tejun Heo2026/09/04 06:39

Re: [PATCH 12/18] sched_ext: Generalize the reject DSQ reenqueue path

> @@ -1599,11 +1599,10 @@ static void scx_dispatch_enqueue(struct scx_sched *sch, struct rq *rq, > struct scx_dispatch_q *dsq, struct task_struct *p, > u64 slice, u64 vtime, u64 enq_flags) > { > - bool is_rq_owned = false; > + bool is_rq_owned = dsq_is_rq_owned(dsq); > > if (dsq->id == SCX_DSQ_LOCAL) { > dsq = scx_reso...

回复liwanwu2026/09/03 15:05

Re: [PATCH 1/2] sched_ext: Make scx_locked_rq() return NULL from NMI

https://lore.kernel.org/r/d84b31727f04e1ed0d40042ba1c09e61@kernel.org > Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: > > New issues: > - [High] scx_bpf_cpuperf_set() and scx_bpf_cidperf_set() deadlock in NMI when scx_locked_rq() returns NULL. > > Pre-existing issues: > - [H...

PATCHWanwu Li2026/09/03 14:06

[PATCH v3] sched_ext: Fix NULL sched deref in kfunc sub-sched error paths

changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 10af28a9f2c0..1c9e4eace89e 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -8943,10 +8943,17 @@ __bpf_kfunc void scx_bpf_dsq_insert_vtime(struct task_struct *p, u64 dsq_id, - * which scheduler called us, just error out @p's s...

回复sashiko-bot2026/09/03 12:18

Re: [PATCH 1/2] sched_ext: Make scx_locked_rq() return NULL from NMI

https://lore.kernel.org/r/d84b31727f04e1ed0d40042ba1c09e61@kernel.org https://sashiko.dev/#/patchset/20260903032953.659847-1-liwanwu@kylinos.cn?part=1 > diff --git a/kernel/sched/ext/internal.h b/kernel/sched/ext/internal.h > index 27bbf5e04d900..faa80ac5a653a 100644 > --- a/kernel/sched/ext/internal.h > +++ b/kernel/s...

PATCHWanwu Li2026/09/03 11:58

[PATCH 2/2] sched_ext: Protect the idle-search scratch nodemask with irqsave

https://lore.kernel.org/r/d84b31727f04e1ed0d40042ba1c09e61@kernel.org changed diff --git a/kernel/sched/ext/idle.c b/kernel/sched/ext/idle.c index d2973fb3af6d..93e2e0b2d1f8 100644 --- a/kernel/sched/ext/idle.c +++ b/kernel/sched/ext/idle.c @@ -153,7 +153,18 @@ static s32 pick_idle_cpu_from_online_nodes(const struct cp...

PATCHWanwu Li2026/09/03 11:57

[PATCH 1/2] sched_ext: Make scx_locked_rq() return NULL from NMI

https://lore.kernel.org/r/d84b31727f04e1ed0d40042ba1c09e61@kernel.org changed diff --git a/kernel/sched/ext/internal.h b/kernel/sched/ext/internal.h index a67277b0fee6..809e0ee0fd5f 100644 --- a/kernel/sched/ext/internal.h +++ b/kernel/sched/ext/internal.h @@ -2218,6 +2218,15 @@ static inline void scx_schedule_reenq_lo...

PATCHWanwu Li2026/09/03 11:30

[PATCH 0/2] sched_ext: two more context-safety fixes found in the NMI kfunc audit

Continuing the audit that the sashiko bot kicked off on the NMI-reject series, I went through every kfunc exposed to BPF_PROG_TYPE_TRACING (the any / idle / cid context-filter sets). Two more context-safety issues came out of it; this pair addresses both. - Patch 1 fixes the scx_locked_rq() class (three "any"-category ...

回复liwanwu2026/09/03 09:46

Re: [PATCH v3] sched_ext: Reject NMI calls to lock-taking kfuncs

> Hello, > > On Wed, Sep 02, 2026 at 05:36:11PM +0800, Wanwu Li wrote: >> +#define scx_kf_allowed_ctx(sch) \ >> +({ \ >> + bool __allowed = true; \ > > Applied to sched_ext/for-7.4 with the following changes: > > - "No need to wrap" in my v2 reply was about the line wrap of the function > signature. Restored the inline...

回复Tejun Heo2026/09/03 07:05

Re: [PATCH v3] sched_ext: Reject NMI calls to lock-taking kfuncs

> +#define scx_kf_allowed_ctx(sch) \ > +({ \ > + bool __allowed = true; \ Hello, On Wed, Sep 02, 2026 at 05:36:11PM +0800, Wanwu Li wrote: Applied to sched_ext/for-7.4 with the following changes: - "No need to wrap" in my v2 reply was about the line wrap of the function signature. Restored the inline function + macro w...

回复Tejun Heo2026/09/03 05:51

Re: [PATCH v2] sched_ext: Reject NMI calls to lock-taking kfuncs

> Three "any"-category kfuncs read scx_locked_rq() on their success path > and treat a non-NULL return as "the rq lock is already held by me", > which a false positive under NMI turns into either a data race or a > wrong result: > pick_idle_cpu_from_online_nodes() (kernel/sched/ext/idle.c:151), which > writes the per-C...

回复Tejun Heo2026/09/03 03:40

Re: [PATCH v2] sched_ext: Fix NULL sched deref in kfunc sub-sched error paths

> > + scx_error(scx_task_sched_rcu(p) ?: sch, > > + "__scx_bpf_select_cpu_and() must be used"); > > As the fallback only triggers for tasks already past sched_ext_dead() (or > idle tasks), tearing down the root scheduler doesn't make sense. How about > adding a flag to the root sched and printing a warning once instead...

回复Tejun Heo2026/09/03 03:37

Re: [PATCH v2] sched_ext: Fix NULL sched deref in kfunc sub-sched error paths

> Neither wrapper requires a contrived @p. Tasks that are never enabled -- > kthreads and tasks of other classes under SCX_SWITCH_ALL=n -- keep > p->scx.sched NULL indefinitely; and a task handed over from > Keep the "error out @p's scheduler" attribution -- it is what every other > kfunc error path does (select_cpu_fr...

回复Andrea Righi2026/09/03 02:11

Re: [PATCH v2] sched_ext: Fix NULL sched deref in kfunc sub-sched error paths

> The COMPAT kfunc wrappers scx_bpf_select_cpu_and() and > scx_bpf_dsq_insert_vtime() error out @p's scheduler when the root > scheduler has sub-scheds attached: > > scx_error(scx_task_sched(p), "... must be used"); > > scx_task_sched(p) is p->scx.sched, which is NULL for any task that is not > on an scx scheduler: it ...

回复Tejun Heo2026/09/03 01:48

Re: [PATCH v2] sched_ext: don't deliver duplicate ops.cgroup_set_idle() for same value

> ops.cgroup_set_idle() is documented to be invoked when a cgroup > transitions between idle and non-idle states, and scx_group_set_weight() > already skips value-preserving writes. scx_group_set_idle() delivers > every write unconditionally, so rewriting an already-correct cpu.idle > value feeds the BPF scheduler a tr...

PATCHWanwu Li2026/09/03 01:08

[PATCH v2] sched_ext: Fix NULL sched deref in kfunc sub-sched error paths

changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 10af28a9f2c0..fdfaa7e9c8f5 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -8943,10 +8943,15 @@ __bpf_kfunc void scx_bpf_dsq_insert_vtime(struct task_struct *p, u64 dsq_id, - * which scheduler called us, just error out @p's s...

回复liwanwu2026/09/03 00:34

Re: [PATCH] sched_ext: Fix NULL sched deref in select_cpu_and sub-sched error path

> Hi Wanwu, > > On Wed, Sep 02, 2026 at 11:36:40PM +0800, Wanwu Li wrote: >> scx_bpf_select_cpu_and() errors out @p's scheduler when the root scheduler >> has sub-scheds attached: >> >> scx_error(scx_task_sched(p), "... must be used"); >> >> scx_task_sched(p) is p->scx.sched, which is NULL for any task that is not >> o...

回复Andrea Righi2026/09/03 00:14

Re: [PATCH] sched_ext: Fix NULL sched deref in select_cpu_and sub-sched error path

> scx_bpf_select_cpu_and() errors out @p's scheduler when the root scheduler > has sub-scheds attached: > > scx_error(scx_task_sched(p), "... must be used"); > > scx_task_sched(p) is p->scx.sched, which is NULL for any task that is not > on an scx scheduler: it is memset() by init_scx_entity() and cleared by > scx_disa...

回复sashiko-bot2026/09/02 23:58

Re: [PATCH] sched_ext: Fix NULL sched deref in select_cpu_and sub-sched error path

> scx_bpf_dsq_insert_vtime() has the same error path but it is not reachable > with a NULL @p: SYSCALL programs are rejected for its kfunc set and @p is > always the calling scheduler's own task in the contexts where it runs, so > it is left unchanged. https://sashiko.dev/#/patchset/20260902153640.144791-1-liwanwu@kyli...

PATCHWanwu Li2026/09/02 23:36

[PATCH] sched_ext: Fix NULL sched deref in select_cpu_and sub-sched error path

changed diff --git a/kernel/sched/ext/idle.c b/kernel/sched/ext/idle.c index d2973fb3af6d..014599d82bb0 100644 --- a/kernel/sched/ext/idle.c +++ b/kernel/sched/ext/idle.c @@ -1142,10 +1142,15 @@ __bpf_kfunc s32 scx_bpf_select_cpu_and(struct task_struct *p, s32 prev_cpu, u64 - * which scheduler called us, just error out...

回复liwanwu2026/09/02 21:48

Re: [PATCH v2] sched_ext: Reject NMI calls to lock-taking kfuncs

> Hello, > > On Wed, Sep 02, 2026 at 10:31:24AM +0800, Wanwu Li wrote: >> - if (sch) >> - destroy_dsq(sch, dsq_id); >> + if (!sch) >> + return; > > unlikely(!sch) like the other kfuncs. > >> @@ -9756,6 +9755,9 @@ __bpf_kfunc struct task_struct *bpf_iter_scx_dsq_next(struct bpf_iter_scx_dsq *i >> if (!kit->dsq) >> retur...

回复sashiko-bot2026/09/02 17:51

Re: [PATCH v3] sched_ext: Reject NMI calls to lock-taking kfuncs

https://lore.kernel.org/r/20260901095652.1009104-1-liwanwu@kylinos.cn https://sashiko.dev/#/patchset/20260902093611.52651-1-liwanwu@kylinos.cn?part=1 > diff --git a/kernel/sched/ext/internal.h b/kernel/sched/ext/internal.h > index 27bbf5e04d900..ca8ebb11f03ca 100644 > --- a/kernel/sched/ext/internal.h > +++ b/kernel/sc...

PATCHWanwu Li2026/09/02 17:36

[PATCH v3] sched_ext: Reject NMI calls to lock-taking kfuncs

https://lore.kernel.org/r/20260901095652.1009104-1-liwanwu@kylinos.cn https://lore.kernel.org/r/20260902023124.1422942-1-liwanwu@kylinos.cn https://lore.kernel.org/r/20260901095652.1009104-1-liwanwu@kylinos.cn changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 10af28a9f2c0..3f8bde1dbb4c 100644 -...

回复Michał Błaszczyk2026/09/02 16:07

Re: [PATCH] sched_ext: Use atomic cpumask_clear_cpu in scx_idle_test_and_clear_cpu()

> I think the atomic clear makes sense here, but, as sashiko also pointed out, it > does not fully address the race, because idle_smts is also modified by the > non-atomic cpumask_andnot() below and cpumask_or() in update_builtin_idle(). > > > Fixes: 48849271e661 ("sched_ext: idle: Per-node idle cpumasks") > > And the ...

回复Tejun Heo2026/09/02 14:57

Re: [PATCH v2] sched_ext: Skip per-CPU data allocation for built-in DSQs

Applied to sched_ext/for-7.4 with Zhan's Reviewed-by added, the description reworded to say the waste is quadratic in the CPU count, and the scx_init_dsq() comment reworded as the local DSQ does track deferred reenqs, just through sch->pcpu. Thanks. -- tejun

回复Tejun Heo2026/09/02 14:44

Re: [PATCH v2] sched_ext: Reject NMI calls to lock-taking kfuncs

> - if (sch) > - destroy_dsq(sch, dsq_id); > + if (!sch) > + return; > @@ -9756,6 +9755,9 @@ __bpf_kfunc struct task_struct *bpf_iter_scx_dsq_next(struct bpf_iter_scx_dsq *i > if (!kit->dsq) > return NULL; > > + if (!scx_kf_allowed_ctx(kit->dsq->sched)) > + return NULL; > +static __always_inline bool __scx_kf_allowed_c...

回复Tejun Heo2026/09/02 14:42

Re: [PATCH v3 0/2] sched_ext: document and enforce vtime ordering constraints

> Tao Cui (2): > sched_ext: document the rolling-cursor requirement for dsq_vtime > sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe On Wed, Sep 02, 2026 at 10:48:10AM +0800, Tao Cui wrote: Applied 1-2 to sched_ext/for-7.4 with the subjects capitalized. Thanks. -- tejun

回复Tejun Heo2026/09/02 14:02

Re: [PATCH] sched_ext: Delete sub-scheduler kobjects before releasing scx_enable_mutex

> Hello Tejun, > > On Tue, Sep 01, 2026 at 09:56:51AM -1000, Tejun Heo wrote: > > Why is this a problem? The subsched hasn't been fully unloaded yet so if you > > try to attach a new one, it's going to fail. > > When the mutex is released, the cgroup has already been given back to the > parent and the exiting scheduler...

回复Qiurong Fang2026/09/02 11:23

Re: [PATCH] sched_ext: Delete sub-scheduler kobjects before releasing scx_enable_mutex

> Why is this a problem? The subsched hasn't been fully unloaded yet so if you > try to attach a new one, it's going to fail. Hello Tejun, On Tue, Sep 01, 2026 at 09:56:51AM -1000, Tejun Heo wrote: When the mutex is released, the cgroup has already been given back to the parent and the exiting scheduler unlinked - its ...

回复sashiko-bot2026/09/02 11:03

Re: [PATCH v3 2/2] sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe

https://lore.kernel.org/r/3f1ce004-e259-4e72-a5f7-14a5050053bd@linux.dev https://sashiko.dev/#/patchset/20260902024812.794879-1-cui.tao@linux.dev?part=2 > diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c > index fec3595818269..acc1995630e6d 100644 > --- a/tools/sched_ext/scx_flatcg.bpf.c...

PATCHTao Cui2026/09/02 10:48

[PATCH v3 2/2] sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe

https://lore.kernel.org/r/3f1ce004-e259-4e72-a5f7-14a5050053bd@linux.dev changed diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c index 454ebb820c5e..5e6abd0bccb3 100644 --- a/tools/sched_ext/scx_flatcg.bpf.c +++ b/tools/sched_ext/scx_flatcg.bpf.c @@ -144,7 +144,7 @@ static bool cgv_node...

PATCHTao Cui2026/09/02 10:48

[PATCH v3 1/2] sched_ext: document the rolling-cursor requirement for dsq_vtime

changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 8041c87a3562..81a506a4c8ab 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -8903,7 +8903,9 @@ struct scx_bpf_dsq_insert_vtime_args { - * ordering and vice-versa. + * ordering and vice-versa. vtime is a rolling cursor and valu...

PATCHTao Cui2026/09/02 10:48

[PATCH v3 0/2] sched_ext: document and enforce vtime ordering constraints

From: Tao Cui <cuitao@kylinos.cn> Patch 1 documents the rolling-cursor requirement for vtime ordering in scx_bpf_dsq_insert_vtime(). Patch 2 fixes scx_flatcg's comparator to use the cyclic comparison, which is correct there because cgrp_cap_budget() upholds that requirement. Changes since v2: - 1/2: "less than 2^63 apa...

PATCHWanwu Li2026/09/02 10:33

[PATCH v2] sched_ext: Reject NMI calls to lock-taking kfuncs

https://lore.kernel.org/r/20260901095652.1009104-1-liwanwu@kylinos.cn changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 10af28a9f2c0..09ce239e9c4b 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -9518,14 +9518,8 @@ void scx_kick_cpu(struct scx_sched *sch, s32 cpu, u64 flags)...

回复Tao Cui2026/09/02 09:21

Re: [PATCH v2 2/2] sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe

> Hello, > > On Tue, Sep 01, 2026 at 10:03:43PM +0800, Tao Cui wrote: > ... >> long-running host. At the wrap instant the plain comparison puts the >> wrapped node behind everything else permanently. > > Plain < puts the wrapped node at the front. The unwrapped ones get stuck > behind it. Also, each CPU picking a cgrou...

回复Tejun Heo2026/09/02 05:16

Re: [PATCH] sched_ext: Reject NMI calls to lock-taking kfuncs

> + if (!scx_kfunc_nmi_safe(__func__, sch)) > + return -EBUSY; > +/* > + * sched_ext kfuncs that take scheduler locks are not NMI-safe: a > + * BPF_PROG_TYPE_TRACING program can be attached to a function that runs in > + * NMI, and scx_kfunc_context_filter() lets such a program call every kfunc in > + * the any/cid/idl...

回复Andrea Righi2026/09/02 04:28

Re: [PATCH] sched_ext: Reject NMI calls to lock-taking kfuncs

> Hello, > > On Tue, Sep 01, 2026 at 09:51:37PM +0200, Andrea Righi wrote: > > AFAICS, the lock-taking and state-changing kfuncs do not have a meaningful use > > from BPF_PROG_TYPE_TRACING. We could move them out of scx_kfunc_ids_any into a > > separate set registered only for BPF_PROG_TYPE_STRUCT_OPS. The read-only kf...

回复Andrea Righi2026/09/02 04:17

Re: [PATCH] sched_ext: Delete sub-scheduler kobjects before releasing scx_enable_mutex

> From: fangqiurong <fangqiurong@kylinos.cn> > > The sub-scheduler disable path deletes the scheduler's kobjects after > releasing scx_enable_mutex, while the root path deletes them before > releasing it. A concurrent enable on the same cgroup can therefore hit > kobject_add() with the same "sub-%llu" name still in the...

回复Tejun Heo2026/09/02 04:13

Re: [PATCH] sched_ext: Reject NMI calls to lock-taking kfuncs

> AFAICS, the lock-taking and state-changing kfuncs do not have a meaningful use > from BPF_PROG_TYPE_TRACING. We could move them out of scx_kfunc_ids_any into a > separate set registered only for BPF_PROG_TYPE_STRUCT_OPS. The read-only kfuncs > could remain available to tracing programs. > > This should include: > - s...

回复Tejun Heo2026/09/02 04:00

Re: [PATCH v2 2/2] sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe

> long-running host. At the wrap instant the plain comparison puts the > wrapped node behind everything else permanently. > cyclic comparison is valid as an rbtree comparator only because > cgrp_cap_budget() clamps every node to within max_budget behind > cvtime_now, so any two nodes are far less than 2^63 apart and th...

回复Tejun Heo2026/09/02 03:59

Re: [PATCH v2 1/2] sched_ext: document the rolling-cursor requirement for dsq_vtime

> + * should stay within half the u64 range (2^63) of each other so that > + * time_before64() ordering remains well-defined. Hello, On Tue, Sep 01, 2026 at 10:03:42PM +0800, Tao Cui wrote: ... Two values exactly 2^63 apart are before each other in both directions, so "less than 2^63 apart". Also, please fold this into...

回复Tejun Heo2026/09/02 03:56

Re: [PATCH] sched_ext: Delete sub-scheduler kobjects before releasing scx_enable_mutex

> From: fangqiurong <fangqiurong@kylinos.cn> > > The sub-scheduler disable path deletes the scheduler's kobjects after > releasing scx_enable_mutex, while the root path deletes them before > releasing it. A concurrent enable on the same cgroup can therefore hit > kobject_add() with the same "sub-%llu" name still in the...

回复Andrea Righi2026/09/02 03:51

Re: [PATCH] sched_ext: Reject NMI calls to lock-taking kfuncs

> commit e06ece82d7b0 ("sched_ext: Report NMI kicks with scx_error()") made > scx_bpf_kick_cpu() reject NMI calls, and its cover letter describes the > reachability: sched_ext kfuncs in the "any" category "are callable from > tracing progs that can attach to functions running in NMI", and an unlucky > call from there "...

回复Andrea Righi2026/09/02 00:20

Re: [PATCH] sched_ext: Use atomic cpumask_clear_cpu in scx_idle_test_and_clear_cpu()

> In scx_idle_test_and_clear_cpu(), the shared idle_smts mask is modified > locklessly by concurrent CPUs. Currently, the code uses > __cpumask_clear_cpu() to clear a CPU from the mask. Because this is > a non-atomic read-modify-write operation, concurrent modifications to > different bits within the same memory word c...

回复sashiko-bot2026/09/01 23:29

Re: [PATCH] sched_ext: Use atomic cpumask_clear_cpu in scx_idle_test_and_clear_cpu()

> diff --git a/kernel/sched/ext/idle.c b/kernel/sched/ext/idle.c > index 6f93cc32b650e..7be0b5d189cdc 100644 > --- a/kernel/sched/ext/idle.c > +++ b/kernel/sched/ext/idle.c > @@ -103,7 +103,7 @@ static bool scx_idle_test_and_clear_cpu(int cpu) > if (cpumask_intersects(smt, idle_smts)) > cpumask_andnot(idle_smts, idle_s...

PATCHMichal Blaszczyk2026/09/01 23:22

[PATCH] sched_ext: Use atomic cpumask_clear_cpu in scx_idle_test_and_clear_cpu()

changed diff --git a/kernel/sched/ext/idle.c b/kernel/sched/ext/idle.c index d2973fb3af6d..8985b48c83a5 100644 --- a/kernel/sched/ext/idle.c +++ b/kernel/sched/ext/idle.c @@ -104,7 +104,7 @@ static bool scx_idle_test_and_clear_cpu(int cpu) - __cpumask_clear_cpu(cpu, idle_smts); + cpumask_clear_cpu(cpu, idle_smts); In s...

回复sashiko-bot2026/09/01 22:19

Re: [PATCH v2 2/2] sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe

https://lore.kernel.org/r/3f1ce004-e259-4e72-a5f7-14a5050053bd@linux.dev https://sashiko.dev/#/patchset/20260901140343.764080-1-cui.tao@linux.dev?part=2 > diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c > index fec3595818269..3a25cfdc97092 100644 > --- a/tools/sched_ext/scx_flatcg.bpf.c...

PATCHTao Cui2026/09/01 22:04

[PATCH v2 2/2] sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe

https://lore.kernel.org/r/3f1ce004-e259-4e72-a5f7-14a5050053bd@linux.dev changed diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c index 454ebb820c5e..be03b409db5e 100644 --- a/tools/sched_ext/scx_flatcg.bpf.c +++ b/tools/sched_ext/scx_flatcg.bpf.c @@ -144,7 +144,8 @@ static bool cgv_node...

PATCHTao Cui2026/09/01 22:04

[PATCH v2 1/2] sched_ext: document the rolling-cursor requirement for dsq_vtime

changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 8041c87a3562..9030962f4df1 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -8905,6 +8905,11 @@ struct scx_bpf_dsq_insert_vtime_args { + * vtime is a rolling cursor and should be treated as a virtual timestamp + * that advance...

PATCHTao Cui2026/09/01 22:03

[PATCH v2 0/2] sched_ext: document and enforce vtime ordering constraints

From: Tao Cui <cuitao@kylinos.cn> Patch 1 documents the rolling-cursor and half-range requirement for dsq_vtime ordering in scx_bpf_dsq_insert_vtime(). Patch 2 fixes scx_flatcg's comparator to use the cyclic comparison, which is correct there because cgrp_cap_budget() upholds that requirement. Changes since v1: - drop ...

回复sashiko-bot2026/09/01 20:56

Re: [PATCH v2] sched_ext: don't deliver duplicate ops.cgroup_set_idle() for same value

https://lore.kernel.org/r/b53c61a1-4d7d-4232-941f-d48b0563d4ed@linux.dev https://sashiko.dev/#/patchset/20260901124347.755904-1-cui.tao@linux.dev?part=1 > diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c > index c539d15cda637..c72d9780830b8 100644 > --- a/kernel/sched/ext/ext.c > +++ b/kernel/sched/ext/ext....

PATCHTao Cui2026/09/01 20:44

[PATCH v2] sched_ext: don't deliver duplicate ops.cgroup_set_idle() for same value

https://lore.kernel.org/r/b53c61a1-4d7d-4232-941f-d48b0563d4ed@linux.dev changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 8041c87a3562..8b3625107b72 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -4933,7 +4933,8 @@ void scx_group_set_idle(struct task_group *tg, bool idle) ...

回复Tao Cui2026/09/01 20:35

Re: [PATCH] sched_ext: don't deliver duplicate ops.cgroup_set_idle() for same value

https://lore.kernel.org/r/b53c61a1-4d7d-4232-941f-d48b0563d4ed https://lore.kernel.org/r/b53c61a1-4d7d-4232-941f-d48b0563d4ed@linux.dev > Hi Tao, > > On Tue, Sep 01, 2026 at 11:11:01AM +0800, Tao Cui wrote: >> From: Tao Cui <cuitao@kylinos.cn> >> >> ops.cgroup_set_idle() is documented to be invoked when a cgroup >> tra...

PATCHQiurong Fang2026/09/01 18:22

[PATCH] sched_ext: Delete sub-scheduler kobjects before releasing scx_enable_mutex

changed diff --git a/kernel/sched/ext/sub.c b/kernel/sched/ext/sub.c index a17d84db93bd..1923e3023bff 100644 --- a/kernel/sched/ext/sub.c +++ b/kernel/sched/ext/sub.c @@ -1631,6 +1631,12 @@ void scx_sub_disable(struct scx_sched *sch) + if (sch->sub_kset) + kobject_del(&sch->sub_kset->kobj); + /* not added if enable fai...

PATCHWanwu Li2026/09/01 17:57

[PATCH] sched_ext: Reject NMI calls to lock-taking kfuncs

changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 10af28a9f2c0..a0b886975e1d 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -5108,6 +5108,9 @@ static void destroy_dsq(struct scx_sched *sch, u64 dsq_id) + if (!scx_kfunc_nmi_safe("scx_bpf_destroy_dsq()", sch)) + return; + @@ ...

回复Tao Cui2026/09/01 17:44

Re: [PATCH 1/2] sched_ext: fix vtime priority queue inversion on wide vtime spread

> Hi Tao, > > On Tue, Sep 01, 2026 at 10:40:37AM +0800, Tao Cui wrote: >> From: Tao Cui <cuitao@kylinos.cn> >> >> scx_dsq_priq_less() compares dsq_vtime with time_before64(), a cyclic >> comparison that is only valid when the values in the queue are less >> than 2^63 apart. Unlike CFS, which enforces that invariant wit...

回复Tejun Heo2026/09/01 16:29

Re: [PATCH 1/2] sched_ext: fix vtime priority queue inversion on wide vtime spread

> than 2^63 apart. Unlike CFS, which enforces that invariant with > min_vruntime clamping, sched_ext takes dsq_vtime directly from the BPF > scheduler and cannot bound the spread. A scheduler that inserts tasks Hello, On Tue, Sep 01, 2026 at 10:40:37AM +0800, Tao Cui wrote: ... This doesn't make any practical sense. ds...

回复Richard Cheng2026/09/01 15:52

Re: [PATCH 17/18] sched_ext: scx_qmap: Add proxy execution support

> Add a -X option to opt scx_qmap into queueing mutex-blocked tasks for > proxy execution. Without the option, SCX_OPS_ENQ_BLOCKED remains clear > and mutex waiters block normally. With -X, blocked donors are passed to > qmap_enqueue() with SCX_ENQ_BLOCKED. > > When scx_qmap receives a blocked donor, select a cid allow...

回复Andrea Righi2026/09/01 15:26

Re: [PATCH] sched_ext: don't deliver duplicate ops.cgroup_set_idle() for same value

https://lore.kernel.org/r/b53c61a1-4d7d-4232-941f-d48b0563d4ed > From: Tao Cui <cuitao@kylinos.cn> > > ops.cgroup_set_idle() is documented to be invoked when a cgroup > transitions between idle and non-idle states, and scx_group_set_weight() > already skips value-preserving writes. scx_group_set_idle() delivers > every...

回复Andrea Righi2026/09/01 14:47

Re: [PATCH 1/2] sched_ext: fix vtime priority queue inversion on wide vtime spread

> From: Tao Cui <cuitao@kylinos.cn> > > scx_dsq_priq_less() compares dsq_vtime with time_before64(), a cyclic > comparison that is only valid when the values in the queue are less > than 2^63 apart. Unlike CFS, which enforces that invariant with > min_vruntime clamping, sched_ext takes dsq_vtime directly from the BPF >...

回复K Prateek Nayak2026/09/01 13:24

Re: [PATCH 02/18] sched/core: Dequeue waking proxy donors before reset

> proxy_needs_return() resets an active donor while holding blocked_lock. > proxy_reset_donor() invokes scheduling-class callbacks, adding an > unnecessary raw-spinlock nesting. It also presents the waking donor to > put_prev_task() as still runnable immediately before block_task() > removes it from the runqueue. > Spl...

回复bot+bpf-ci2026/09/01 11:54

Re: [PATCH 2/2] sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe

[-- Attachment #1: Type: text/plain, Size: 1751 bytes --] https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md https://github.com/kernel-patches/bpf/actions/runs/33465241568 https://lore.kernel.org/r/3f1ce004-e259-4e72-a5f7-14a5050053bd@linux.dev > cgv_node_less() compares cvtimes with a plain <, wh...

回复sashiko-bot2026/09/01 11:22

Re: [PATCH] sched_ext: don't deliver duplicate ops.cgroup_set_idle() for same value

https://lore.kernel.org/r/b53c61a1-4d7d-4232-941f-d48b0563d4ed https://sashiko.dev/#/patchset/20260901031101.731943-1-cui.tao@linux.dev?part=1 > diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c > index c539d15cda637..c72d9780830b8 100644 > --- a/kernel/sched/ext/ext.c > +++ b/kernel/sched/ext/ext.c > @@ -49...

PATCHTao Cui2026/09/01 11:11

[PATCH] sched_ext: don't deliver duplicate ops.cgroup_set_idle() for same value

https://lore.kernel.org/r/b53c61a1-4d7d-4232-941f-d48b0563d4ed changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 8041c87a3562..8b3625107b72 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -4933,7 +4933,8 @@ void scx_group_set_idle(struct task_group *tg, bool idle) - if (scx_...

回复sashiko-bot2026/09/01 10:54

Re: [PATCH 1/2] sched_ext: fix vtime priority queue inversion on wide vtime spread

> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c > index 18183062f751c..db1ea9054c0ca 100644 > --- a/kernel/sched/ext/ext.c > +++ b/kernel/sched/ext/ext.c > @@ -1356,7 +1356,8 @@ static bool scx_dsq_priq_less(struct rb_node *node_a, > const struct task_struct *b = > container_of(node_b, struct task_struct...

回复sashiko-bot2026/09/01 10:51

Re: [PATCH 2/2] sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe

https://lore.kernel.org/r/3f1ce004-e259-4e72-a5f7-14a5050053bd@linux.dev https://sashiko.dev/#/patchset/20260901024038.730424-1-cui.tao@linux.dev?part=2 > diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c > index fec3595818269..3a25cfdc97092 100644 > --- a/tools/sched_ext/scx_flatcg.bpf.c...

PATCHTao Cui2026/09/01 10:41

[PATCH 2/2] sched_ext/scx_flatcg: make cgv_node_less() wraparound-safe

https://lore.kernel.org/r/3f1ce004-e259-4e72-a5f7-14a5050053bd@linux.dev changed diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c index 454ebb820c5e..be03b409db5e 100644 --- a/tools/sched_ext/scx_flatcg.bpf.c +++ b/tools/sched_ext/scx_flatcg.bpf.c @@ -144,7 +144,8 @@ static bool cgv_node...

PATCHTao Cui2026/09/01 10:41

[PATCH 0/2] sched_ext: fix wraparound-unsafe vtime orderings

From: Tao Cui <cuitao@kylinos.cn> Two spots order tasks by 64-bit virtual time with comparisons that break when the values are far apart: the kernel's vtime DSQ priority queue and scx_flatcg's cgroup tree. They need opposite fixes, which is the point of this series. The kernel's scx_dsq_priq_less() compares with time_b...

PATCHTao Cui2026/09/01 10:40

[PATCH 1/2] sched_ext: fix vtime priority queue inversion on wide vtime spread

changed diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 8041c87a3562..dd0ce01370d1 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -1417,7 +1417,8 @@ static bool scx_dsq_priq_less(struct rb_node *node_a, - return time_before64(a->scx.dsq_vtime, b->scx.dsq_vtime); + /* dsq_vtime is...

回复Zhan Xusheng2026/09/01 10:20

Re: [PATCH v2] sched_ext: Skip per-CPU data allocation for built-in DSQs

> Every DSQ still allocates nr_cpu_ids * sizeof(struct scx_dsq_pcpu) > bytes of per-CPU memory for it. The v2 note says the waste is described as quadratic, but the changelog still gives it per DSQ: Four of the five built-in ids come one per CPU: SCX_DSQ_BYPASS in the for_each_possible_cpu() at ext.c:7173, SCX_DSQ_LOCA...

PATCHQiurong Fang2026/09/01 09:33

[PATCH v2] sched_ext: Skip per-CPU data allocation for built-in DSQs

changed diff --git a/include/linux/sched/ext.h b/include/linux/sched/ext.h index 582d7cd4a983..3c793d51c000 100644 --- a/include/linux/sched/ext.h +++ b/include/linux/sched/ext.h @@ -91,7 +91,7 @@ struct scx_dispatch_q { - struct scx_dsq_pcpu __percpu *pcpu; + struct scx_dsq_pcpu __percpu *pcpu_user; diff --git a/kerne...

回复Andrew Morton2026/09/01 08:46

Re: [PATCH v3 0/4] selftests: shared lib.bpf.mk for building BPF progs and skeletons

> Just want to follow-up on this patch series. Please let me know the possible > issues and I will fix them. https://sashiko.dev/#/patchset/20260814075054.507089-1-ziyang.meme@gmail.com On Mon, 31 Aug 2026 15:18:53 -0700 Ziyang Men <ziyang.meme@gmail.com> wrote: It was sent two weeks ago, during the merge window and bp...

回复Tejun Heo2026/09/01 06:37

Re: [PATCH sched_ext/for-7.3-fixes] sched_ext: Serialize cgroup knob updates

> Concurrent cgroup knob writes update the core scheduler under its > internal locks and notify sched_ext only after those locks are released. http://lkml.kernel.org/r/20260824074913.2468177-1-michalblk@google.com Hello, Andrea. On Tue, Aug 25, 2026 at 11:21:53AM +0200, Andrea Righi wrote: This is the same race Michal'...

回复Tejun Heo2026/09/01 06:36

Re: [PATCH v3] sched: Lift cgroup update locking to core to prevent CFS/SCX divergence

> Concurrent writes to cgroup control files (such as cpu.shares or > cpu.weight) can lead to state divergence between CFS and SCX. > > For instance, in cpu_shares_write_u64(), the CFS update is serialized > by shares_mutex (internal to fair.c), but this lock is dropped before > scx_group_set_weight() is called. The lat...

回复Ziyang Men2026/09/01 06:18

Re: [PATCH v3 0/4] selftests: shared lib.bpf.mk for building BPF progs and skeletons

>This series re-factors the bpf-related toolchain for selftests, which >currently duplicated across selftests/{bpf,sched_ext,hid}/. Unify them >into a single includable fragment, the tools/testing/selftests/lib.bpf.mk, >and wires up three consumers. We believe this will simplify the work for >configuring selftests with...