From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752479AbbCZRiP (ORCPT ); Thu, 26 Mar 2015 13:38:15 -0400 Received: from foss.arm.com ([217.140.101.70]:54193 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751018AbbCZRiK (ORCPT ); Thu, 26 Mar 2015 13:38:10 -0400 Date: Thu, 26 Mar 2015 17:38:45 +0000 From: Morten Rasmussen To: Vincent Guittot Cc: Peter Zijlstra , Ingo Molnar , linux-kernel , Preeti U Murthy , Kamalesh Babulal , Rik van Riel , Mike Galbraith , "nicolas.pitre@linaro.org" , Dietmar Eggemann , Linaro Kernel Mailman List , Paul Turner , Ben Segall Subject: Re: [PATCH v10 04/11] sched: Make sched entity usage tracking scale-invariant Message-ID: <20150326173845.GM18994@e105550-lin.cambridge.arm.com> References: <1425052454-25797-1-git-send-email-vincent.guittot@linaro.org> <1425052454-25797-5-git-send-email-vincent.guittot@linaro.org> <20150323131905.GF23123@twins.programming.kicks-ass.net> <20150325173309.GS21418@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed, Mar 25, 2015 at 06:08:42PM +0000, Vincent Guittot wrote: > On 25 March 2015 at 18:33, Peter Zijlstra wrote: > > On Tue, Mar 24, 2015 at 11:00:57AM +0100, Vincent Guittot wrote: > >> On 23 March 2015 at 14:19, Peter Zijlstra wrote: > >> > On Fri, Feb 27, 2015 at 04:54:07PM +0100, Vincent Guittot wrote: > >> > > >> >> + unsigned long scale_freq = arch_scale_freq_capacity(NULL, cpu); > >> > > >> >> + sa->running_avg_sum += delta_w * scale_freq > >> >> + >> SCHED_CAPACITY_SHIFT; > >> > > >> > so the only thing that could be improved is somehow making this > >> > multiplication go away when the arch doesn't implement the function. > >> > > >> > But I'm not sure how to do that without #ifdef. > >> > > >> > Maybe a little something like so then... that should make the compiler > >> > get rid of those multiplications unless the arch needs them. > >> > >> yes, it removes useless multiplication when not used by an arch. > >> It also adds a constraint on the arch side which have to define > >> arch_scale_freq_capacity like below: > >> > >> #define arch_scale_freq_capacity xxx_arch_scale_freq_capacity > >> with xxx_arch_scale_freq_capacity an architecture specific function > > > > Yeah, but it not being weak should make that a compile time warn/fail, > > which should be pretty easy to deal with. > > > >> If it sounds acceptable i can update the patch with your proposal ? > > > > I'll stick it to the end, I just wanted to float to patch to see if > > people had better solutions. > > ok. all other methods that i have tried, was removing the optimization > when default arch_scale_freq_capacity was used Another potential solution is to stay with weak functions but move the multiplication and shift into the arch_scale_*() functions by passing the value we want to scale into the arch_scale_*() function. That way we can completely avoid multiplication and shift in the default case (no arch_scale*() implementations, which is better than what we have today. The only downside is that for frequency invariance we need three arch_scale_freq_capacity() calls instead of two.