[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABFh=a5e0jAfLV7m8VBsDwUEOziMpeHDvyAf-9oTPYqsk3N6_g@mail.gmail.com>
Date: Mon, 10 Nov 2025 17:06:24 -0500
From: Emil Tsalapatis <linux-lists@...alapatis.com>
To: Tejun Heo <tj@...nel.org>
Cc: David Vernet <void@...ifault.com>, Andrea Righi <andrea.righi@...ux.dev>,
Changwoo Min <changwoo@...lia.com>, Dan Schatzberg <schatzberg.dan@...il.com>,
Emil Tsalapatis <etsal@...a.com>, sched-ext@...ts.linux.dev, linux-kernel@...r.kernel.org,
Andrea Righi <arighi@...dia.com>
Subject: Re: [PATCH v2 03/14] sched_ext: Refactor do_enqueue_task() local and
global DSQ paths
On Mon, Nov 10, 2025 at 3:57 PM Tejun Heo <tj@...nel.org> wrote:
>
> The local and global DSQ enqueue paths in do_enqueue_task() share the same
> slice refill logic. Factor out the common code into a shared enqueue label.
> This makes adding new enqueue cases easier. No functional changes.
>
> Reviewed-by: Andrea Righi <arighi@...dia.com>
> Signed-off-by: Tejun Heo <tj@...nel.org>
> ---
Reviewed-by: Emil Tsalapatis <emil@...alapatis.com>
> kernel/sched/ext.c | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index abf2075f174f..b18864655d3a 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -1279,6 +1279,7 @@ static void do_enqueue_task(struct rq *rq, struct task_struct *p, u64 enq_flags,
> {
> struct scx_sched *sch = scx_root;
> struct task_struct **ddsp_taskp;
> + struct scx_dispatch_q *dsq;
> unsigned long qseq;
>
> WARN_ON_ONCE(!(p->scx.flags & SCX_TASK_QUEUED));
> @@ -1346,8 +1347,17 @@ static void do_enqueue_task(struct rq *rq, struct task_struct *p, u64 enq_flags,
> direct:
> direct_dispatch(sch, p, enq_flags);
> return;
> -
Nit: Similar to the note for the next patch, we could inline the
dispatch_enqueue where the goto local_norefill statement is (though
the current code is pretty easy to follow - all the dispatch
statements are organized into what is basically a big switch
statement, with the goto labels doubling as documentation).
> +local_norefill:
> + dispatch_enqueue(sch, &rq->scx.local_dsq, p, enq_flags);
> + return;
> local:
> + dsq = &rq->scx.local_dsq;
> + goto enqueue;
> +global:
> + dsq = find_global_dsq(sch, p);
> + goto enqueue;
> +
> +enqueue:
> /*
> * For task-ordering, slice refill must be treated as implying the end
> * of the current slice. Otherwise, the longer @p stays on the CPU, the
> @@ -1355,14 +1365,7 @@ static void do_enqueue_task(struct rq *rq, struct task_struct *p, u64 enq_flags,
> */
> touch_core_sched(rq, p);
> refill_task_slice_dfl(sch, p);
> -local_norefill:
> - dispatch_enqueue(sch, &rq->scx.local_dsq, p, enq_flags);
> - return;
> -
> -global:
> - touch_core_sched(rq, p); /* see the comment in local: */
> - refill_task_slice_dfl(sch, p);
> - dispatch_enqueue(sch, find_global_dsq(sch, p), p, enq_flags);
> + dispatch_enqueue(sch, dsq, p, enq_flags);
> }
>
> static bool task_runnable(const struct task_struct *p)
> --
> 2.51.2
>
>
Powered by blists - more mailing lists