From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752405AbbIGNX3 (ORCPT ); Mon, 7 Sep 2015 09:23:29 -0400 Received: from casper.infradead.org ([85.118.1.10]:49208 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750848AbbIGNX1 (ORCPT ); Mon, 7 Sep 2015 09:23:27 -0400 Date: Mon, 7 Sep 2015 15:23:23 +0200 From: Peter Zijlstra To: Morten Rasmussen Cc: mingo@redhat.com, vincent.guittot@linaro.org, daniel.lezcano@linaro.org, Dietmar Eggemann , yuyang.du@intel.com, mturquette@baylibre.com, rjw@rjwysocki.net, Juri Lelli , sgurrappadi@nvidia.com, pang.xunlei@zte.com.cn, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/6] sched/fair: Compute capacity invariant load/utilization tracking Message-ID: <20150907132323.GV18673@twins.programming.kicks-ass.net> References: <1439569394-11974-1-git-send-email-morten.rasmussen@arm.com> <20150831092449.GJ19282@twins.programming.kicks-ass.net> <20150907124220.GT18673@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150907124220.GT18673@twins.programming.kicks-ass.net> 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 Mon, Sep 07, 2015 at 02:42:20PM +0200, Peter Zijlstra wrote: > I'm of a mind to apply these patches; with two patches on top, which > I'll post shortly. --- Subject: sched: Optimize __update_load_avg() From: Peter Zijlstra Date: Mon Sep 7 15:09:15 CEST 2015 Prior to this patch; the line: scaled_delta_w = (delta_w * 1024) >> 10; which is the result of the default arch_scale_freq_capacity() function, turns into: 1b03: 49 89 d1 mov %rdx,%r9 1b06: 49 c1 e1 0a shl $0xa,%r9 1b0a: 49 c1 e9 0a shr $0xa,%r9 Which is silly; when made unsigned int, GCC recognises this as pointless ops and fails to emit them (confirmed on 4.9.3 and 5.1.1). Furthermore, afaict unsigned is actually the correct type for these fields anyway, as we've explicitly ruled out negative delta's earlier in this function. Signed-off-by: Peter Zijlstra (Intel) --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2551,7 +2551,7 @@ __update_load_avg(u64 now, int cpu, stru { u64 delta, scaled_delta, periods; u32 contrib; - int delta_w, scaled_delta_w, decayed = 0; + unsigned int delta_w, scaled_delta_w, decayed = 0; unsigned long scale_freq = arch_scale_freq_capacity(NULL, cpu); unsigned long scale_cpu = arch_scale_cpu_capacity(NULL, cpu);