From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched_ext: Refresh idle state when kicking CPUs
Date: Fri, 3 Jan 2025 09:55:14 +0100 [thread overview]
Message-ID: <Z3el8tUA_B8d6aBH@gpd3> (raw)
In-Reply-To: <Z3cUIkOkfZ3n-XTz@slm.duckdns.org>
On Thu, Jan 02, 2025 at 12:33:06PM -1000, Tejun Heo wrote:
> Hello,
>
> On Wed, Jan 01, 2025 at 07:24:49PM +0100, Andrea Righi wrote:
> ...
> > @@ -6104,6 +6117,7 @@ static bool kick_one_cpu(s32 cpu, struct rq *this_rq, unsigned long *pseqs)
> > should_wait = true;
> > }
> >
> > + refresh_idle_state_on_kick(rq);
> > resched_curr(rq);
>
> I'm not sure this is quite correct. e.g. This can cause multiple
> back-to-back busy->busy transitions and can incorrectly assert idle when the
> CPU ends up running non-idle tasks afterwards.
Right, we solve one issue, but it might result in some CPUs being marked as
idle even though they're actively running a task.
>
> When the put_prev/set_next paths were reorganized, we lost the signal on the
> CPU re-entering idle from idle. However, that signal is still available if
> we hook into idle_class->pick_task(), right? So, if we move
> update_idle(true) call there and make sure that we don't generate an event
> on busy->busy transitions, we should be able to restore the previous
> behavior?
Which is basically what I did here:
https://lore.kernel.org/lkml/20241015111539.12136-1-andrea.righi@linux.dev/
We didn't fully like this, because it'd introduce unbalanced transitions,
as update_idle(cpu, true) can be generated multiple times. But it's
probably fine, at the end we would just restore the original behavior and
it'd allow to solve both the "pick_idle + kick CPU" and the "kick from
update_idle()" scenarios.
If we like this approach I can send a new patch updating the comment to
better clarify the scenarios that we are trying to solve. What do you
think?
Thanks,
-Andrea
next prev parent reply other threads:[~2025-01-03 8:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-01 18:24 [PATCH] sched_ext: Refresh idle state when kicking CPUs Andrea Righi
2025-01-02 22:33 ` Tejun Heo
2025-01-03 8:55 ` Andrea Righi [this message]
2025-01-03 21:39 ` Tejun Heo
2025-01-04 7:06 ` Andrea Righi
2025-01-06 18:53 ` Tejun Heo
2025-01-08 0:17 ` 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=Z3el8tUA_B8d6aBH@gpd3 \
--to=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=void@manifault.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