From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752338AbbCXM7c (ORCPT ); Tue, 24 Mar 2015 08:59:32 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:44927 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752096AbbCXM7a (ORCPT ); Tue, 24 Mar 2015 08:59:30 -0400 Date: Tue, 24 Mar 2015 13:59:13 +0100 From: Peter Zijlstra To: Morten Rasmussen Cc: "mingo@redhat.com" , "vincent.guittot@linaro.org" , Dietmar Eggemann , "yuyang.du@intel.com" , "preeti@linux.vnet.ibm.com" , "mturquette@linaro.org" , "nico@linaro.org" , "rjw@rjwysocki.net" , Juri Lelli , "linux-kernel@vger.kernel.org" Subject: Re: [RFCv3 PATCH 28/48] sched: Use capacity_curr to cap utilization in get_cpu_usage() Message-ID: <20150324125913.GO21418@twins.programming.kicks-ass.net> References: <1423074685-6336-1-git-send-email-morten.rasmussen@arm.com> <1423074685-6336-29-git-send-email-morten.rasmussen@arm.com> <20150323161400.GJ23123@twins.programming.kicks-ass.net> <20150324113651.GE18994@e105550-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150324113651.GE18994@e105550-lin.cambridge.arm.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 24, 2015 at 11:36:51AM +0000, Morten Rasmussen wrote: > On Mon, Mar 23, 2015 at 04:14:00PM +0000, Peter Zijlstra wrote: > > On Wed, Feb 04, 2015 at 06:31:05PM +0000, Morten Rasmussen wrote: > > > > > @@ -4596,9 +4596,10 @@ static int get_cpu_usage(int cpu) > > > { > > > unsigned long usage = cpu_rq(cpu)->cfs.utilization_load_avg; > > > unsigned long blocked = cpu_rq(cpu)->cfs.utilization_blocked_avg; > > > + unsigned long capacity_curr = capacity_curr_of(cpu); > > > > > > - if (usage + blocked >= SCHED_LOAD_SCALE) > > > - return capacity_orig_of(cpu); > > > + if (usage + blocked >= capacity_curr) > > > + return capacity_curr; > > > > It makes more sense to do return capacity_curr_of(), since that defers > > the computation capacity_curr_of() does to the point where its actually > > required, instead of making it unconditional. > > capacity_curr_of() is used in the if-condition itself as well so we need > it unconditionally. No? Duh.. I can't read it seems ;-)