Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754728AbcCJK1L (ORCPT ); Thu, 10 Mar 2016 05:27:11 -0500 Received: from mail-lb0-f177.google.com ([209.85.217.177]:34074 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935303AbcCJK04 (ORCPT ); Thu, 10 Mar 2016 05:26:56 -0500 MIME-Version: 1.0 In-Reply-To: <20160310100728.GT6344@twins.programming.kicks-ass.net> References: <56D8AEB7.2050100@linaro.org> <36459679.vzZnOsAVeg@vostro.rjw.lan> <20160308112759.GF6356@twins.programming.kicks-ass.net> <20160308192640.GD6344@twins.programming.kicks-ass.net> <20160309163930.GP6356@twins.programming.kicks-ass.net> <20160310100728.GT6344@twins.programming.kicks-ass.net> From: Vincent Guittot Date: Thu, 10 Mar 2016 17:26:34 +0700 Message-ID: Subject: Re: [PATCH 6/6] cpufreq: schedutil: New governor based on scheduler utilization data To: Peter Zijlstra Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Steve Muckle , Linux PM list , Juri Lelli , ACPI Devel Maling List , Linux Kernel Mailing List , Srinivas Pandruvada , Viresh Kumar , Michael Turquette , Ingo Molnar Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1784 Lines: 46 On 10 March 2016 at 17:07, Peter Zijlstra wrote: > On Thu, Mar 10, 2016 at 10:44:21AM +0700, Vincent Guittot wrote: >> We have the arch_scale_freq_capacity function that is arch dependent >> and can be used to merge the 2 formula that were described by peter >> above. >> By default, arch_scale_freq_capacity return SCHED_CAPACITY_SCALE which >> is max capacity >> but when arch_scale_freq_capacity is defined by an architecture, > >> arch_scale_freq_capacity returns current_freq * max_capacity/max_freq > > However, current_freq is a very fluid thing, it might (and will) change > very rapidly on some platforms. > > This is the same point I made earlier, you cannot try and divide out > current_freq from the invariant measure. > >> so can't we use arch_scale_freq in your formula ? Taking your formula >> above it becomes: >> next_freq = 1.25 * current_freq * util / arch_scale_freq_capacity() > > No, that cannot work, nor makes any sense, per the above. > >> With invariance feature, we have: >> >> next_freq = 1.25 * current_freq * util / (current_freq*max_capacity/max_freq) >> = 1.25 * util * max_freq / max >> >> which is the formula that has to be used with frequency invariant >> utilization. > > Wrong, you cannot talk about current_freq in the invariant case. > >> May be we can pass arch_scale_freq_capacity value instead of max one >> as a parameter of update_util function prototype > > No, since its a compile time thing, we can simply do: > > #ifdef arch_scale_freq_capacity > next_freq = (1 + 1/n) * max_freq * (util / max) > #else > next_freq = (1 + 1/n) * current_freq * (util_raw / max) > #endif selecting formula at compilation is clearly better. I wrongly thought that it can't be accepted as a solution.