Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754572AbcCYVYw (ORCPT ); Fri, 25 Mar 2016 17:24:52 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:19422 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754381AbcCYVYv (ORCPT ); Fri, 25 Mar 2016 17:24:51 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Fri, 25 Mar 2016 14:23:10 -0700 Message-ID: <56F5AC75.1000305@nvidia.com> Date: Fri, 25 Mar 2016 14:24:05 -0700 From: Sai Gurrappadi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Steve Muckle , Peter Zijlstra , Ingo Molnar CC: , , "Rafael J. Wysocki" , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Michael Turquette , Subject: Re: [PATCH 2/2] sched/fair: do not call cpufreq hook unless util changed References: <1458606068-7476-1-git-send-email-smuckle@linaro.org> <1458606068-7476-2-git-send-email-smuckle@linaro.org> <56F47C89.9070201@nvidia.com> <56F48DFA.8020602@linaro.org> In-Reply-To: <56F48DFA.8020602@linaro.org> X-NVConfidentiality: public Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.187.121] X-ClientProxiedBy: HQMAIL104.nvidia.com (172.18.146.11) To HQMAIL101.nvidia.com (172.20.187.10) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3755 Lines: 85 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