All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hui Su" <sh_def@163.com>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH v4 1/5] sched: Dispatch task ticks for donor and execution classes
Date: Wed, 09 Sep 2026 09:46:30 +0000	[thread overview]
Message-ID: <20260909094630.765871F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260909092901.2989564-2-sh_def@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Infinite timeslice and preemption bypass during SCX proxy execution due to a mismatch between slice decrement (execution context) and slice checking (scheduling context).
--

commit ff57ff4a11692a1b0d98a6cd57257eb58a1bd864
Author: Hui Su <sh_def@163.com>

sched: Dispatch task ticks for donor and execution classes

Proxy execution can run a task from one scheduling class on behalf of a donor
from another. This patch updates sched_class::task_tick() to drop the task
argument, using a common dispatcher to call the donor class first and, if
needed, the execution class second.

Link: https://lore.kernel.org/r/20260908104407.GD687043@noisy.programming.kicks-ass.net

> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 51de1d8b72a1e..70815bef52960 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
[ ... ]
> @@ -3789,9 +3789,15 @@ void scx_tick(struct rq *rq)
>  	update_other_load_avgs(rq);
>  }
>  
> -static void task_tick_scx(struct rq *rq, struct task_struct *curr, int queued)
> +static void task_tick_scx(struct rq *rq, int queued)
>  {
> -	struct scx_sched *sch = scx_task_sched(curr);
> +	struct task_struct *curr = rq->donor;
> +	struct scx_sched *sch;
> +
> +	if (curr->sched_class != &ext_sched_class)
> +		return;
> +
> +	sch = scx_task_sched(curr);
>  
>  	update_curr_scx(rq);

[Severity: High]
Does this cause an infinite timeslice for SCX tasks during proxy execution?

When an SCX task acts as a donor in proxy execution, task_tick_scx() sets
curr to rq->donor. However, update_curr_scx() applies the slice
decrement to the execution context (rq->curr):

static void update_curr_scx(struct rq *rq)
{
        struct task_struct *curr = rq->curr;
        ...
        if (curr->scx.slice != SCX_SLICE_INF)
                curr->scx.slice -= min_t(u64, curr->scx.slice, delta_exec);
        ...
}

Later in task_tick_scx(), the slice check is performed against the donor
task which was never decremented:

        if (!curr->scx.slice)
                resched_curr(rq);

Since the donor's slice doesn't decrease, it will never hit zero, meaning
resched_curr(rq) is bypassed indefinitely.

Additionally, if the proxy task is SCX but the donor is not, task_tick_scx()
returns early here because the donor is not an SCX task, skipping the SCX
tick processing completely. Should the slice management be explicitly tied
to the execution context rather than the donor?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260909092901.2989564-1-sh_def@163.com?part=1

  reply	other threads:[~2026-09-09  9:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  9:28 [PATCH v4 0/5] sched: Handle split scheduling and execution contexts in task ticks Hui Su
2026-09-09  9:28 ` [PATCH v4 1/5] sched: Dispatch task ticks for donor and execution classes Hui Su
2026-09-09  9:46   ` sashiko-bot [this message]
2026-09-09 10:42   ` Hui Su
2026-09-09 17:43     ` Andrea Righi
2026-09-10 10:49       ` Hui Su
2026-09-09  9:28 ` [PATCH v4 2/5] sched/numa: Drive NUMA task tick from execution context Hui Su
2026-09-09  9:28 ` [PATCH v4 3/5] sched/cache: Drive cache " Hui Su
2026-09-09 11:03   ` Peter Zijlstra
2026-09-10 10:53     ` Hui Su
2026-09-09  9:29 ` [PATCH v4 4/5] sched/rt: Fix RT watchdog accounting for proxy execution Hui Su
2026-09-09 11:04   ` Peter Zijlstra
2026-09-10 10:54     ` Hui Su
2026-09-12 17:30     ` Hui Su
2026-09-09  9:29 ` [PATCH v4 5/5] sched/core: Fix donor slice accounting under " Hui Su
2026-09-10 10:55   ` Hui Su

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260909094630.765871F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sched-ext@lists.linux.dev \
    --cc=sh_def@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.