Re: [PATCH v33 2/7] sched/core: Use the scheduling context for remote ticks

From: Kayra Cizmeci

Date: Sat Oct 24 2026 - 09:45:03 EST


On Fri, Oct 23, 2026 at 10:04:13PM +0000, John Stultz wrote:
> From: "Shubhang Kaushik (Ampere)" <sh@xxxxxxxxxx>

Hi John and Shubhang,

> ---
> kernel/sched/core.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 0ab15f03cb947..729ebaca35e1a 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5934,26 +5934,20 @@ static void sched_tick_remote(struct work_struct *work)
> */
> if (tick_nohz_tick_stopped_cpu(cpu)) {
> guard(rq_lock_irq)(rq);
> - struct task_struct *curr = rq->curr;
> + struct task_struct *donor = rq->donor;
>
> if (cpu_online(cpu)) {
> - /*
> - * Since this is a remote tick for full dynticks mode,
> - * we are always sure that there is no proxy (only a
> - * single task is running).
> - */
> - WARN_ON_ONCE(rq->curr != rq->donor);
> update_rq_clock(rq);
>
> - if (!is_idle_task(curr)) {
> + if (!is_idle_task(donor)) {
> /*
> * Make sure the next tick runs within a
> * reasonable amount of time.
> */
> - u64 delta = rq_clock_task(rq) - curr->se.exec_start;
> + u64 delta = rq_clock_task(rq) - donor->se.exec_start;
> WARN_ON_ONCE(delta > (u64)NSEC_PER_SEC * 30);
> }
> - curr->sched_class->task_tick(rq, curr, 0);
> + donor->sched_class->task_tick(rq, donor, 0);
>
> calc_load_nohz_remote(rq);
> }


The old code already assumes that donor always being equal to
curr. If this is not true, patch is needed. If this true, patch
doesn't change anything since curr == donor. :-).

So even if it's true, this doesn't messes with anything.

And IMO, using donor instead of curr is already cleaner than using
curr. Since we don't need this WARN_ON_ONCE and the comment. AFAICT
more robust too.

So...

(Dramatical pause, important for scenery.)

Reviewed-by: Kayra Cizmeci <kayracizmeci@xxxxxxxxx>

Thanks!


Kayra