From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757946AbbEVPg0 (ORCPT ); Fri, 22 May 2015 11:36:26 -0400 Received: from foss.arm.com ([217.140.101.70]:44175 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757563AbbEVPgX (ORCPT ); Fri, 22 May 2015 11:36:23 -0400 Date: Fri, 22 May 2015 16:38:04 +0100 From: Morten Rasmussen To: Kamalesh Babulal Cc: "peterz@infradead.org" , "mingo@redhat.com" , "vincent.guittot@linaro.org" , Dietmar Eggemann , "yuyang.du@intel.com" , "preeti@linux.vnet.ibm.com" , "mturquette@linaro.org" , "rjw@rjwysocki.net" , Juri Lelli , "sgurrappadi@nvidia.com" , "pang.xunlei@zte.com.cn" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" Subject: Re: [RFCv4 PATCH 22/34] sched: Calculate energy consumption of sched_group Message-ID: <20150522153804.GF26396@e105550-lin.cambridge.arm.com> References: <1431459549-18343-1-git-send-email-morten.rasmussen@arm.com> <1431459549-18343-23-git-send-email-morten.rasmussen@arm.com> <20150521075702.GA20008@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150521075702.GA20008@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 21, 2015 at 08:57:04AM +0100, Kamalesh Babulal wrote: > * Morten Rasmussen [2015-05-12 20:38:57]: > > [...] > > +/* > > + * cpu_norm_usage() returns the cpu usage relative to a specific capacity, > > + * i.e. it's busy ratio, in the range [0..SCHED_LOAD_SCALE] which is useful for > > + * energy calculations. Using the scale-invariant usage returned by > > + * get_cpu_usage() and approximating scale-invariant usage by: > > + * > > + * usage ~ (curr_freq/max_freq)*1024 * capacity_orig/1024 * running_time/time > > + * > > + * the normalized usage can be found using the specific capacity. > > + * > > + * capacity = capacity_orig * curr_freq/max_freq > > + * > > + * norm_usage = running_time/time ~ usage/capacity > > + */ > > +static unsigned long cpu_norm_usage(int cpu, unsigned long capacity) > > +{ > > + int usage = __get_cpu_usage(cpu); > > __get_cpu_usage is introduced in next patch "sched: Extend sched_group_energy > to test load-balancing decisions", applying the series with this patch as top > most patch breaks the build. > > kernel/sched/fair.c: In function ‘cpu_norm_usage’: > kernel/sched/fair.c:4830:2: error: implicit declaration of function ‘__get_cpu_usage’ [-Werror=implicit-function-declaration] > int usage = __get_cpu_usage(cpu); > ^ > > Given that __get_cpu_usage(), take additional parameter - delta. get_cpu_usage() > should have been used here. Yes, you are right. Using get_cpu_usage() here instead should be correct. I think it was right in RFCv3, I must have messed it up when I moved around some of the patches :( I will make sure to test the patch set is bisectable next time :) Thanks, Morten