[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 9 Sep 2018 16:48:19 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel/sched/core.c: Avoid unused variable on non-SMP configs
On Sun, Sep 9, 2018 at 11:36 AM, Borislav Petkov <bp@...en8.de> wrote:
>
> Alternatively, if you don't want to let the crazy ifdeffery in that
> function grow even more, you can simply do:
>
> ---
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 625bc9897f62..1728743360d4 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -136,7 +136,7 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
> * to sched_rt_avg_update. But I don't trust it...
> */
> #if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
> - s64 steal = 0, irq_delta = 0;
> + s64 steal __maybe_unused = 0, irq_delta = 0;
> #endif
Indeed. But note that the attribute needs to be written before the
variable name so that it applies to both variables (or write it twice)
--- see https://godbolt.org/z/cwOeXZ
Also, if we go that route, I would simply remove the #ifdef entirely.
Cheers,
Miguel
Powered by blists - more mailing lists