lkml.org 
[lkml]   [2023]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 2/2] cpuidle: teo: Introduce util-awareness
Hi Kajetan

On 07/18/23 14:24, Qais Yousef wrote:

> These patches are in GKI. So we'll if there are uncaught problems I guess :)
>
> No appetite for a knob, but the very low value for littles did strike me and
> thought I better ask at least. Today's littles are too tiny for their own good
> and it seemed the threshold could end up being too aggressive especially in low
> activity state. You effectively are saying that if we have few 100us of
> activity, normal TEO predictions based on timers are no good and better to stay
> shallower anyway.
>
> Note that due to NOHZ, if we go to idle for an extended period the util value
> might not decay for a while and miss some opportunities. Especially that when
> it next wakes up, it's enough for this wake up to run for few 100s us to block
> a deeper state before going back to sleep for extended period of time.
>
> But we shall see. I got the answer I was looking for for now.

Unfortunately not too long after the patches got merged I got regression report
of worse power. As you know on Android things are not as mainline, so I need to
untangle this to make sure it's not a red herring. But if you want to take my
word for it, I think the chances of it being a true regression is high. I had
to introduce knobs to allow controlling the thresholds for now, so the good
news they do help and it's not a total revert. I don't have a lot of info to
share, but it's the low activity use cases that seem to got impacted. Like
video playback for instance.

Generally, I'm trying to remove some hardcoded values from the scheduler that
enforces a behavior that is not universally desired on all systems/workloads.
And I think the way the util awareness threshold are done today fall into the
same category.

As I tried to highlight before, it is easy to trick the threshold by a task
that runs for a short time then goes back to sleep for a long time.

And when the system runs full throttle for a while, it'll take around 150+ms
for the util to decay to the threshold value. That's a long time to block
entering deeper idle states for. I'm not sure how NOHZ and blocked averaged
updates can make this potentially worse.

In my view, the absolute comparison against util can be misleading. Even when
util is 512 for example, we still have 50% of idle time. How this time is
distributed can't be known from util alone. It could be one task waking up and
sleeping. It could be multiple tasks at many combination of patterns all
leading to the same outcome of CPU util being 512.

IIUC the idea is that if we have even small activity, then erring on the
shallow side is better. But given that target-residency is usually in few ms
range, do we really need to be that quite? With a target-residency of 3ms for
example, even at util of 900 there can be opportunities to enter it.

Can't we instead sample util at entry to idle loop and see if it is on a rising
or falling trend? When rising it makes sense to say there's demand, let's block
deeper idle state. But if it is falling, then if the decay time is longer than
target-residency we can say it's okay to permit the deeper idle states?

I need to think more about this; but I think it's worth trying to make these
thresholds more deterministic and quantifiable. There are too many workloads
and system variations. I'm not sure if a knob to control these thresholds is
good for anything but a workaround like I had to do. These hardcoded values
can be improved IMHO. Happy to help to find alternatives.


Cheers

--
Qais Yousef

\
 
 \ /
  Last update: 2023-09-17 03:08    [W:0.070 / U:1.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site