[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <570BBA4D.1060307@mellanox.com>
Date: Mon, 11 Apr 2016 10:53:01 -0400
From: Chris Metcalf <cmetcalf@...lanox.com>
To: Frederic Weisbecker <fweisbec@...il.com>,
Peter Zijlstra <peterz@...radead.org>
CC: LKML <linux-kernel@...r.kernel.org>,
Byungchul Park <byungchul.park@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Luiz Capitulino <lcapitulino@...hat.com>,
Christoph Lameter <cl@...ux.com>,
"Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>,
Mike Galbraith <efault@....de>, Rik van Riel <riel@...hat.com>,
Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates
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.
--
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com
Powered by blists - more mailing lists