Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932834AbcDLOXt (ORCPT ); Tue, 12 Apr 2016 10:23:49 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:33887 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756212AbcDLOXs (ORCPT ); Tue, 12 Apr 2016 10:23:48 -0400 Date: Tue, 12 Apr 2016 16:23:34 +0200 From: Peter Zijlstra To: Frederic Weisbecker Cc: Chris Metcalf , LKML , Byungchul Park , Thomas Gleixner , Luiz Capitulino , Christoph Lameter , "Paul E . McKenney" , Mike Galbraith , Rik van Riel , Ingo Molnar Subject: Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates Message-ID: <20160412142334.GG1087@worktop> References: <1460077633-23431-1-git-send-email-fweisbec@gmail.com> <1460077633-23431-4-git-send-email-fweisbec@gmail.com> <20160408104821.GM3448@twins.programming.kicks-ass.net> <20160408125521.GC24956@lerouge> <20160408174414.GE1087@worktop> <20160411131814.GA22628@lerouge> <570BBA4D.1060307@mellanox.com> <20160411182129.GB22628@lerouge> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160411182129.GB22628@lerouge> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1258 Lines: 27 On Mon, Apr 11, 2016 at 08:21:31PM +0200, Frederic Weisbecker wrote: > On Mon, Apr 11, 2016 at 10:53:01AM -0400, Chris Metcalf wrote: > > On 4/11/2016 9:18 AM, Frederic Weisbecker wrote: > > >So I tried and it warns about the unused variable tickless_load, so I > > >would need two scattered ifdeffery in the function: > > > > > >@@ -4528,7 +4529,9 @@ decay_load_missed(unsigned long load, unsigned long missed_updates, int idx) > > > static void cpu_load_update(struct rq *this_rq, unsigned long this_load, > > > unsigned long pending_updates) > > > { > > >+#ifdef CONFIG_NO_HZ_COMMON > > > unsigned long tickless_load = this_rq->cpu_load[0]; > > >+#endif > > > > Just move the initialization down to the first use, as a regular > > assignment, and add __maybe_unused to the declaration, and the compiler > > will then keep quiet (see Documentation/CodingStyle). > > > > I have no comment on which of the approaches looks better overall, > > but I think using __maybe_unused definitely improves this approach. > > I thought about it yeah. I usually avoid __maybe_unused because it's often > a bad sign concerning the code layout. > > Now in this precise case I wouldn't mind though. Peter what's your opinion? Sure, go with __maybe_unused.