linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qais Yousef <qyousef@layalina.io>
To: Lukasz Luba <lukasz.luba@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RFC PATCH 0/7] sched: cpufreq: Remove magic margins
Date: Sun, 10 Sep 2023 19:14:19 +0100	[thread overview]
Message-ID: <20230910181419.ljejml3qazom2jgt@airbuntu> (raw)
In-Reply-To: <6011d8bb-9a3b-1435-30b0-d75b39bf5efa@arm.com>

On 09/07/23 08:48, Lukasz Luba wrote:

> They are periodic in a sense, they wake up every 16ms, but sometimes
> they have more work. It depends what is currently going in the game
> and/or sometimes the data locality (might not be in cache).
> 
> Although, that's for games, other workloads like youtube play or this
> one 'Yahoo browser' (from your example) are more 'predictable' (after
> the start up period). And I really like the potential energy saving
> there :)

It is more complicated than that from what I've seen. Userspace is sadly
bloated and the relationship between the tasks are a lot more complex. They
talk to other frame work elements, other hardware, have network elements coming
in, and specifically for gaming, could be preparing multiple frames in
parallel. The task wake up and sleep time is not that periodic. It can busy
loop for periods of time, other wake up for short periods of time (pattern of
which might not be on point as it interacts with other elements in a serial
manner where one prepared something and can take variable time every wake up to
prepare it before handing it over to the next task).

Browsers can be tricky as well as when user scrolls what elements appear and
what java script will execute and how heavy it is, and how many tabs are have
webpages being opened and how the user is moving between them.

It is organized chaos :-)

> 
> > 
> > I think the model of a periodic task is not suitable for most workloads. All
> > of them are dynamic and how much they need to do at each wake up can very
> > significantly over 10s of ms.
> 
> Might be true, the model was built a few years ago when there wasn't
> such dynamic game scenario with high FPS on mobiles. This could still
> be tuned with your new design IIUC (no need extra hooks in Android).

It is my perception of course. But I think generally, not just for gaming,
there are a lot of elements interacting with each others in a complex way.
The wake up time and length is determined by these complex elements; and it is
a very dynamic interaction where they could get into steady state for a very
short period of time but could change quickly. As an extreme example a player
could be standing in empty room doing nothing but another player in another
part of the world launches a rocket on this room and we'd get to know when the
network packet arrives that we have to draw a big explosion.

A lot of workloads are interactive and these moments of interactions are the
challenging ones.

> 
> > 
> > > 2. Plumb in this new idea of dvfs_update_delay as the new
> > >     'margin' - this I don't understand
> > > 
> > > For the 2. I don't see that the dvfs HW characteristics are best
> > > for this problem purpose. We can have a really fast DVFS HW,
> > > but we need some decent spare idle time in some workloads, which
> > > are two independent issues IMO. You might get the higher
> > > idle time thanks to 1.1. but this is a 'side effect'.
> > > 
> > > Could you explain a bit more why this dvfs_update_delay is
> > > crucial here?
> > 
> > I'm not sure why you relate this to idle time. And the word margin is a bit
> > overloaded here. so I suppose you're referring to the one we have in
> > map_util_perf() or apply_dvfs_headroom(). And I suppose you assume this extra
> > headroom will result in idle time, but this is not necessarily true IMO.
> > 
> > My rationale is simply that DVFS based on util should follow util_avg as-is.
> > But as pointed out in different discussions happened elsewhere, we need to
> > provide a headroom for this util to grow as if we were to be exact and the task
> > continues to run, then likely the util will go above the current OPP before we
> > get a chance to change it again. If we do have an ideal hardware that takes
> 
> Yes, this is another requirement to have +X% margin. When the tasks are
> growing, we don't know their final util_avg and we give them a bit more
> cycles.
> IMO we have to be ready always for such situation in the scheduler,
> haven't we?

Yes we should. I think I am not ignoring this part. Hope I clarified things
offline.


Cheers

--
Qais Yousef

  parent reply	other threads:[~2023-09-10 18:14 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-27 23:31 [RFC PATCH 0/7] sched: cpufreq: Remove magic margins Qais Yousef
2023-08-27 23:31 ` [RFC PATCH 1/7] sched/pelt: Add a new function to approximate the future util_avg value Qais Yousef
2023-09-06 12:56   ` Dietmar Eggemann
2023-09-06 21:19     ` Qais Yousef
2023-09-07 11:12       ` Dietmar Eggemann
2023-09-10 19:58         ` Qais Yousef
2023-09-13 17:22           ` Dietmar Eggemann
2023-09-16 19:49             ` Qais Yousef
2023-09-16 19:52               ` Qais Yousef
2023-08-27 23:31 ` [RFC PATCH 2/7] sched/pelt: Add a new function to approximate runtime to reach given util Qais Yousef
2023-09-06 12:56   ` Dietmar Eggemann
2023-09-06 20:44     ` Dietmar Eggemann
2023-09-06 21:38       ` Qais Yousef
2023-09-15  9:15   ` Hongyan Xia
2023-09-16 19:56     ` Qais Yousef
2023-08-27 23:31 ` [RFC PATCH 3/7] sched/fair: Remove magic margin in fits_capacity() Qais Yousef
2023-09-06 14:38   ` Dietmar Eggemann
2023-09-06 21:45     ` Qais Yousef
2023-08-27 23:32 ` [RFC PATCH 4/7] sched: cpufreq: Remove magic 1.25 headroom from apply_dvfs_headroom() Qais Yousef
2023-09-07 11:34   ` Peter Zijlstra
2023-09-10 19:23     ` Qais Yousef
2023-08-27 23:32 ` [RFC PATCH 5/7] sched/schedutil: Add a new tunable to dictate response time Qais Yousef
2023-09-06 21:13   ` Dietmar Eggemann
2023-09-06 21:52     ` Qais Yousef
2023-09-07 11:44   ` Peter Zijlstra
2023-09-10 19:25     ` Qais Yousef
2023-08-27 23:32 ` [RFC PATCH 6/7] sched/pelt: Introduce PELT multiplier Qais Yousef
2023-08-27 23:32 ` [RFC PATCH 7/7] cpufreq: Change default transition delay to 2ms Qais Yousef
2023-09-06  9:18 ` [RFC PATCH 0/7] sched: cpufreq: Remove magic margins Lukasz Luba
2023-09-06 21:18   ` Qais Yousef
2023-09-07  7:48     ` Lukasz Luba
2023-09-07 11:53       ` Peter Zijlstra
2023-09-07 13:06         ` Lukasz Luba
2023-09-07 13:29           ` Peter Zijlstra
2023-09-07 13:33             ` Lukasz Luba
2023-09-07 13:38               ` Peter Zijlstra
2023-09-07 13:45                 ` Lukasz Luba
2023-09-08 12:51                   ` Daniel Bristot de Oliveira
2023-09-12 11:57                     ` Lukasz Luba
2023-09-10 18:20         ` Qais Yousef
2023-09-10 18:14       ` Qais Yousef [this message]
2023-09-07 13:26     ` Peter Zijlstra
2023-09-07 13:57       ` Lukasz Luba
2023-09-07 14:29         ` Peter Zijlstra
2023-09-07 14:42           ` Lukasz Luba
2023-09-07 20:16             ` Peter Zijlstra
2023-09-12 11:51               ` Lukasz Luba
2023-09-12 14:01                 ` Vincent Guittot
2023-09-13  9:53                   ` Lukasz Luba
2023-09-12 14:28                 ` Peter Zijlstra
2023-09-10 19:06             ` Qais Yousef
2023-09-10 18:46       ` Qais Yousef
2023-09-07 13:08 ` Peter Zijlstra
2023-09-08  0:17   ` Qais Yousef
2023-09-08  7:40     ` Dietmar Eggemann
2023-09-08 14:07       ` Qais Yousef
2023-09-12 17:18         ` Dietmar Eggemann
2023-09-16 19:38           ` Qais Yousef
2023-09-08 10:25     ` Peter Zijlstra
2023-09-08 13:33       ` Qais Yousef
2023-09-08 13:58         ` Peter Zijlstra
2023-09-08 13:59         ` Peter Zijlstra
2023-09-08 14:11           ` Qais Yousef
2023-09-10 21:17         ` Qais Yousef

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=20230910181419.ljejml3qazom2jgt@airbuntu \
    --to=qyousef@layalina.io \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).