diff options
| author | Tejun Heo <tj@kernel.org> | 2026-07-01 10:36:34 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-07-01 10:36:34 -1000 |
| commit | 344a14d39c721594addf6505c8d561db1ea6f49e (patch) | |
| tree | 7a8422e364d1ff00ea46cf10f9c2ad0103ae084f | |
| parent | 5df6a4506d060fcc3b875437cea8d77b5950325d (diff) | |
| parent | b7d9c359e5cf867f7eb23df3bb1c6b9e58af24da (diff) | |
| download | linux-stable-344a14d39c721594addf6505c8d561db1ea6f49e.tar.gz linux-stable-344a14d39c721594addf6505c8d561db1ea6f49e.zip | |
sched_ext: Merge branch 'for-7.2-fixes' into for-7.3
for-7.3 will reorganize sub-sched code. Pull in for-7.2-fixes in
preparation.
Signed-off-by: Tejun Heo <tj@kernel.org>
| -rw-r--r-- | kernel/sched/ext/ext.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index a9d23d9f5947..4e0cd08a6a2e 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -3080,9 +3080,14 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p, * sched_class, %SCX_OPS_ENQ_LAST must be set. Tell * ops.enqueue() that @p is the only one available for this cpu, * which should trigger an explicit follow-up scheduling event. + * + * Core scheduling can force this CPU idle while @p stays + * runnable. @p's cookie then won't match the core's, so skip + * the warning in that case. */ if (next && sched_class_above(&ext_sched_class, next->sched_class)) { - WARN_ON_ONCE(!(sch->ops.flags & SCX_OPS_ENQ_LAST)); + WARN_ON_ONCE(sched_cpu_cookie_match(rq, p) && + !(sch->ops.flags & SCX_OPS_ENQ_LAST)); do_enqueue_task(rq, p, SCX_ENQ_LAST, -1); } else { do_enqueue_task(rq, p, 0, -1); @@ -4909,6 +4914,8 @@ static void scx_sched_free_rcu_work(struct work_struct *work) cgroup_put(sch_cgroup(sch)); if (sch->sub_kset) kobject_put(&sch->sub_kset->kobj); + if (scx_parent(sch)) + kobject_put(&scx_parent(sch)->kobj); #endif /* CONFIG_EXT_SUB_SCHED */ for_each_possible_cpu(cpu) { @@ -6889,12 +6896,19 @@ static struct scx_sched *scx_alloc_and_add_sched(struct scx_enable_cmd *cmd, INIT_LIST_HEAD(&sch->children); INIT_LIST_HEAD(&sch->sibling); - if (parent) + if (parent) { + /* + * Pin @parent for @sch's lifetime. The kobject hierarchy pins + * it only via @parent->sub_kset, which is dropped during + * disable. Released in scx_sched_free_rcu_work(). + */ + kobject_get(&parent->kobj); ret = kobject_init_and_add(&sch->kobj, &scx_ktype, &parent->sub_kset->kobj, "sub-%llu", cgroup_id(cgrp)); - else + } else { ret = kobject_init_and_add(&sch->kobj, &scx_ktype, NULL, "root"); + } if (ret < 0) { RCU_INIT_POINTER(ops->priv, NULL); |
