[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250109102212.GR20870@noisy.programming.kicks-ass.net>
Date: Thu, 9 Jan 2025 11:22:12 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Andrea Righi <arighi@...dia.com>
Cc: Tejun Heo <tj@...nel.org>, David Vernet <void@...ifault.com>,
Changwoo Min <changwoo@...lia.com>, Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5] sched_ext: Refresh scx idle state during idle-to-idle
transitions
On Thu, Jan 09, 2025 at 11:19:52AM +0100, Andrea Righi wrote:
> diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> index 621696269584..ffc636ccd54e 100644
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -452,19 +452,33 @@ static void wakeup_preempt_idle(struct rq *rq, struct task_struct *p, int flags)
> static void put_prev_task_idle(struct rq *rq, struct task_struct *prev, struct task_struct *next)
> {
> dl_server_update_idle_time(rq, prev);
> - scx_update_idle(rq, false);
> + scx_update_idle(rq, false, true);
> }
>
> static void set_next_task_idle(struct rq *rq, struct task_struct *next, bool first)
> {
> update_idle_core(rq);
> - scx_update_idle(rq, true);
> + scx_update_idle(rq, true, true);
> schedstat_inc(rq->sched_goidle);
> next->se.exec_start = rq_clock_task(rq);
> }
>
> struct task_struct *pick_task_idle(struct rq *rq)
> {
> + /*
> + * The scx idle state is updated only when the CPU transitions
> + * in/out of SCHED_IDLE, see put_prev_task_idle() and
Idle thread != SCHED_IDLE
> + * set_next_task_idle().
> + *
> + * However, the CPU may also exit/enter the idle state while
> + * running the idle task, for example waking up the CPU via
> + * scx_bpf_kick_cpu() without dispatching a task on it.
> + *
> + * In this case we still need to trigger scx_update_idle() to
> + * ensure a proper management of the scx idle state.
> + */
> + if (rq->curr == rq->idle)
> + scx_update_idle(rq, true, false);
> return rq->idle;
> }
>
> --
> 2.47.1
>
Powered by blists - more mailing lists