Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932590AbdCUNXF (ORCPT ); Tue, 21 Mar 2017 09:23:05 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:44942 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932529AbdCUNXD (ORCPT ); Tue, 21 Mar 2017 09:23:03 -0400 Date: Tue, 21 Mar 2017 14:22:53 +0100 From: Peter Zijlstra To: Vincent Guittot Cc: "Rafael J. Wysocki" , Linux PM , LKML , Srinivas Pandruvada , Viresh Kumar , Juri Lelli , Patrick Bellasi , Joel Fernandes , Morten Rasmussen , Ingo Molnar Subject: Re: [RFC][PATCH v2 2/2] cpufreq: schedutil: Avoid decreasing frequency of busy CPUs Message-ID: <20170321132253.vjp7f72qkubpttmf@hirez.programming.kicks-ass.net> References: <4366682.tsferJN35u@aspire.rjw.lan> <2185243.flNrap3qq1@aspire.rjw.lan> <3300960.HE4b3sK4dn@aspire.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2204 Lines: 41 On Tue, Mar 21, 2017 at 09:50:28AM +0100, Vincent Guittot wrote: > On 20 March 2017 at 22:46, Rafael J. Wysocki wrote: > > To work around this issue use the observation that, from the > > schedutil governor's perspective, it does not make sense to decrease > > the frequency of a CPU that doesn't enter idle and avoid decreasing > > the frequency of busy CPUs. > > I don't fully agree with that statement. > If there are 2 runnable tasks on CPU A and scheduler migrates the > waiting task to another CPU B so CPU A is less loaded now, it makes > sense to reduce the OPP. That's even for that purpose that we have > decided to use scheduler metrics in cpufreq governor so we can adjust > OPP immediately when tasks migrate. > That being said, i probably know why you see such OPP switches in your > use case. When we migrate a task, we also migrate/remove its > utilization from CPU. > If the CPU is not overloaded, it means that runnable tasks have all > computation that they need and don't have any reason to use more when > a task migrates to another CPU. so decreasing the OPP makes sense > because the utilzation is decreasing > If the CPU is overloaded, it means that runnable tasks have to share > CPU time and probably don't have all computations that they would like > so when a task migrate, the remaining tasks on the CPU will increase > their utilization and fill space left by the task that has just > migrated. So the CPU's utilization will decrease when a task migrates > (and as a result the OPP) but then its utilization will increase with > remaining tasks running more time as well as the OPP > > So you need to make the difference between this 2 cases: Is a CPU > overloaded or not. You can't really rely on the utilization to detect > that but you could take advantage of the load which take into account > the waiting time of tasks I'm confused. What two cases? You only list the overloaded case, but he does exactly that. Note that the lack of idle time is an exact equivalent of 100% utilized. So even while we cannot currently detect the 100% utilized state through the running state tracking; because averages etc.. we can detect the lack of idle time.