BPF List
 help / color / mirror / Atom feed
From: Andrea Righi <andrea.righi@linux.dev>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
	Peter Zijlstra <peterz@infradead.org>,
	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, bpf@vger.kernel.org
Subject: Re: [PATCH v4] sched_ext: Trigger ops.update_idle() from pick_task_idle()
Date: Wed, 16 Oct 2024 00:12:34 +0200	[thread overview]
Message-ID: <Zw7o0ot9Utomq9qa@gpd3> (raw)
In-Reply-To: <Zw6KuWHPn9d6GWOK@gpd3>

On Tue, Oct 15, 2024 at 05:31:09PM +0200, Andrea Righi wrote:
...
> > - For the purpose of determining whether a CPU is idle for e.g. task
> >   placement from ops.select_cpu(). The CPU *should* be considered idle in
> >   this polling state.
> > 
> > Overall, it feels a bit contrived to generate update_idle() events
> > consecutively for this. If a scheduler wants to poll in idle state, can't it
> > do something like the following?
> > 
> > - Trigger kick from update_idle(cpu, true) and remember that the CPU is in
> >   the polling state.
> > 
> > - Keep kicking from ops.dispatch() until polling state is cleared.
> > 
> > As what kick() guarnatees is at least one dispatch event after kicking, this
> > is guaranteed to be correct and the control flow, while a bit more
> > complicated, makes sense - it triggers dispatch on idle transition and keeps
> > dispatching in the idle state.
> > 
> > What do you think?
> 
> That seems to work in theory, I'll run some tests to confirm that it
> also works in practice. :)
> 
> It looks definitely nicer than triggering multiple ops.update_idle()
> from the kernel and we can maintain the proper semantic of triggering
> update_idle() only on actual idle state changes.

For the record, this seems to be working for now. Here is the
implementation of the idea proposed by Tejun:
https://github.com/sched-ext/scx/commit/40ccca8cbef8fc73e16bfb789c7565326b3cca62

Therefore, we can ignore the kernel patch.

Thanks for the help on this!
-Andrea

  reply	other threads:[~2024-10-15 22:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 11:15 [PATCH v4] sched_ext: Trigger ops.update_idle() from pick_task_idle() Andrea Righi
2024-10-15 14:41 ` Tejun Heo
2024-10-15 15:31   ` Andrea Righi
2024-10-15 22:12     ` Andrea Righi [this message]
2024-10-16 12:26 ` 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=Zw7o0ot9Utomq9qa@gpd3 \
    --to=andrea.righi@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=bsegall@google.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=peterz@infradead.org \
    --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