]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched_ext: Add scx_sched back pointer to scx_sched_pcpu
authorTejun Heo <tj@kernel.org>
Fri, 6 Mar 2026 17:58:04 +0000 (07:58 -1000)
committerTejun Heo <tj@kernel.org>
Fri, 6 Mar 2026 17:58:04 +0000 (07:58 -1000)
Add a back pointer from scx_sched_pcpu to scx_sched. This will be used by
the next patch to make scx_bpf_reenqueue_local() sub-sched aware.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
kernel/sched/ext.c
kernel/sched/ext_internal.h

index 70d0f9e8ef61055b8df14ec0f3a268cbb847c68f..e8378d59ddae857a9e7a7e05ff920ce44f584443 100644 (file)
@@ -5655,6 +5655,9 @@ static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *ops,
        for_each_possible_cpu(cpu)
                init_dsq(bypass_dsq(sch, cpu), SCX_DSQ_BYPASS, sch);
 
+       for_each_possible_cpu(cpu)
+               per_cpu_ptr(sch->pcpu, cpu)->sch = sch;
+
        sch->helper = kthread_run_worker(0, "sched_ext_helper");
        if (IS_ERR(sch->helper)) {
                ret = PTR_ERR(sch->helper);
index 9268df30be7f7208b842998b7d349734940a81fe..69d6e9b4d78eb7b3e78a673a2fb5d97343a194ce 100644 (file)
@@ -933,6 +933,8 @@ struct scx_event_stats {
        s64             SCX_EV_SUB_BYPASS_DISPATCH;
 };
 
+struct scx_sched;
+
 enum scx_sched_pcpu_flags {
        SCX_SCHED_PCPU_BYPASSING        = 1LLU << 0,
 };
@@ -953,6 +955,7 @@ struct scx_dsp_ctx {
 };
 
 struct scx_sched_pcpu {
+       struct scx_sched        *sch;
        u64                     flags;  /* protected by rq lock */
 
        /*