lkml.org 
[lkml]   [2018]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] kernel/sched/core.c: Avoid unused variable on non-SMP configs
On Sun, Sep 9, 2018 at 11:36 AM, Borislav Petkov <bp@alien8.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

\
 
 \ /
  Last update: 2018-09-09 16:49    [W:0.082 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site