From: Peter Zijlstra <peterz@infradead.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5] sched_ext: Refresh scx idle state during idle-to-idle transitions
Date: Thu, 9 Jan 2025 11:22:12 +0100 [thread overview]
Message-ID: <20250109102212.GR20870@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250109101952.443769-1-arighi@nvidia.com>
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
>
next prev parent reply other threads:[~2025-01-09 10:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 10:19 [PATCH v5] sched_ext: Refresh scx idle state during idle-to-idle transitions Andrea Righi
2025-01-09 10:22 ` Peter Zijlstra [this message]
2025-01-09 10:31 ` Andrea Righi
2025-01-10 6:34 ` kernel test robot
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=20250109102212.GR20870@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=arighi@nvidia.com \
--cc=bsegall@google.com \
--cc=changwoo@igalia.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=void@manifault.com \
--cc=vschneid@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox