linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sai Gurrappadi <sgurrappadi@nvidia.com>
To: Steve Muckle <steve.muckle@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Juri Lelli <Juri.Lelli@arm.com>,
	Patrick Bellasi <patrick.bellasi@arm.com>,
	Michael Turquette <mturquette@baylibre.com>,
	<pboonstoppel@nvidia.com>
Subject: Re: [PATCH 2/2] sched/fair: do not call cpufreq hook unless util changed
Date: Fri, 25 Mar 2016 14:24:05 -0700	[thread overview]
Message-ID: <56F5AC75.1000305@nvidia.com> (raw)
In-Reply-To: <56F48DFA.8020602@linaro.org>

On 03/24/2016 06:01 PM, Steve Muckle wrote:
> Hi Sai,
> 
> On 03/24/2016 04:47 PM, Sai Gurrappadi wrote:
>>> @@ -2850,7 +2851,8 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
>>>  	cfs_rq->load_last_update_time_copy = sa->last_update_time;
>>>  #endif
>>>  
>>> -	if (cpu == smp_processor_id() && &rq->cfs == cfs_rq) {
>>> +	if (cpu == smp_processor_id() && &rq->cfs == cfs_rq &&
>>> +	    (decayed || removed_util)) {
>>>  		unsigned long max = rq->cpu_capacity_orig;
>>
>> Should this filtering instead happen on the governor side?
> 
> Perhaps but that also means making a trip into that logic from this hot
> path. To me it seemed better to avoid the overhead if possible,
> especially since we already have info here on whether the util changed.
> But if everyone agrees the overhead is negligible I'm happy to drop the
> patch.

I agree, ideally we skip a pointless function call as long as we make sure we
aren't dropping important frequency requests.

> 
>> Even if the CFS load itself didn't change, we could have switched from an
>> RT/DL thread to a CFS thread so util would have to be updated from ULONG_MAX
>> to whatever CFS needs right?
> 
> Agreed, given the current state of things this will delay the ramp down
> in that case. The current scheme of having a single vote for CPU
> capacity seems broken overall to me however.

Yup, the current hooks just stomp on each other. Need to organize that better.
Not to mention the interaction with the throttling bit on the governor side.

> 
> If the CPU goes idle after RT/DL execution we'll leave the vote at fmax
> until cpufreq_sched starts ignoring it due to staleness.

Note that the same thing can happen due to throttling on the governor side so
it isn't just this change per-say. I do realize it won't be possible to track
all freq. requests perfectly especially given how often the hook fires right
now but something to keep in mind.

> 
> More importantly though, without capacity vote aggregation from
> CFS/RT/DL it doesn't seem possible to ensure appropriate capacity. If
> CFS keeps setting the capacity when it runs to a capacity based solely
> on the CFS requirement, and there is RT or DL utilization in the system,
> won't it tend to be underserved? It may actually be better to be lazy in
> ramping down from fmax to compensate for not including RT/DL's
> utilization, until we can more accurately calculate it.

Could potentially make CFS requests based off of max available CFS capacity
i.e cpu_capacity instead of cpu_capacity_orig. But yes I agree, there needs to
be better interaction between the classes.

> 
> We need vote aggregation from each sched class. This has been posted
> both as part of the now-defunct schedfreq series as well as Mike
> Turquette's recent series, which I hear he's working on rebasing.
> 
> Once that is in we need to decide how RT tasks should vote. I'm not
> really a fan of the decision to run them at fmax. I think this changes
> their semantics and it will be a non-starter for platforms with power
> constraints and/or slow frequency transition times. Perhaps we could
> make it configurable how the RT class should vote. It should be the RT
> class's responsibility though IMO to reduce/drop its vote when necessary
> though, which would address your concern above.

The Fmax bit for RT I think is very much a per-platform decision based on
voltage ramp up/down times, power/thermal budget etc.

> 
>> Also now that CFS enqueue calls cpufreq_update_util, RT/DL requests could
>> potentially get overridden.
> 
> I think this was already busted - enqueue_task_fair() calls
> update_load_avg() on the sched entities in the hierarchy which were
> already enqueued.

Yup, that was busted before too.

-Sai

  reply	other threads:[~2016-03-25 21:24 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22  0:21 [PATCH 1/2] sched/fair: move cpufreq hook to update_cfs_rq_load_avg() Steve Muckle
2016-03-22  0:21 ` [PATCH 2/2] sched/fair: do not call cpufreq hook unless util changed Steve Muckle
2016-03-24 23:47   ` Sai Gurrappadi
2016-03-25  1:01     ` Steve Muckle
2016-03-25 21:24       ` Sai Gurrappadi [this message]
2016-04-23 12:57   ` [tip:sched/core] sched/fair: Do " tip-bot for Steve Muckle
2016-03-28 12:02 ` [PATCH 1/2] sched/fair: move cpufreq hook to update_cfs_rq_load_avg() Dietmar Eggemann
2016-03-28 16:34   ` Steve Muckle
2016-03-28 18:30     ` Dietmar Eggemann
2016-03-28 19:38       ` Steve Muckle
2016-03-30 19:35         ` Peter Zijlstra
2016-03-31  1:42           ` Steve Muckle
2016-03-31  7:37             ` Peter Zijlstra
2016-03-31 21:26               ` Steve Muckle
2016-04-01  9:20                 ` Peter Zijlstra
2016-04-11 19:28                   ` Steve Muckle
2016-04-11 21:20                     ` Rafael J. Wysocki
2016-04-12 14:29                       ` Rafael J. Wysocki
2016-04-12 19:38                         ` Steve Muckle
2016-04-13 14:45                           ` Rafael J. Wysocki
2016-04-13 17:53                             ` Steve Muckle
2016-04-13 19:39                               ` Rafael J. Wysocki
2016-04-13  0:08                         ` Steve Muckle
2016-04-13  4:48                           ` Rafael J. Wysocki
2016-04-13 16:05                             ` Rafael J. Wysocki
2016-04-13 16:07                               ` Rafael J. Wysocki
2016-04-13 18:06                                 ` Steve Muckle
2016-04-13 19:50                                   ` Rafael J. Wysocki
2016-04-20  2:22                                     ` Steve Muckle
2016-03-31  9:27           ` Vincent Guittot
2016-03-31  9:34             ` Peter Zijlstra
2016-03-31  9:50               ` Vincent Guittot
2016-03-31 10:47                 ` Peter Zijlstra
2016-03-31 12:14                   ` Vincent Guittot
2016-03-31 12:34                     ` Peter Zijlstra
2016-03-31 12:50                       ` Vincent Guittot
2016-04-23 12:57 ` [tip:sched/core] sched/fair: Move " tip-bot for Steve Muckle

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=56F5AC75.1000305@nvidia.com \
    --to=sgurrappadi@nvidia.com \
    --cc=Juri.Lelli@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=patrick.bellasi@arm.com \
    --cc=pboonstoppel@nvidia.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=steve.muckle@linaro.org \
    --cc=vincent.guittot@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).