[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240528100128.41ee5fbf@rorschach.local.home>
Date: Tue, 28 May 2024 10:01:28 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Li zeming <zeming@...china.com>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched: core: Remove unnecessary ‘NULL’ values from core_rq
On Tue, 28 May 2024 15:14:46 +0800
Li zeming <zeming@...china.com> wrote:
> core_rq is assigned first, so it does not need to initialize the
> assignment.
No, it is assigned in a loop. Yes, the loop should always execute once,
but the compiler doesn't know that (hence the WARN_ON() that checks
it). That means removing the NULL assignment will likely cause the
warning from the compiler that the variable may be used uninitialized.
The assignment is there at least to quiet the compiler. It's not a fast
path, and the initialization is not a problem.
NACK.
-- Steve
>
> Signed-off-by: Li zeming <zeming@...china.com>
> ---
> kernel/sched/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index e32fea8f5830..346159a24705 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6485,7 +6485,7 @@ static void sched_core_cpu_starting(unsigned int cpu)
> static void sched_core_cpu_deactivate(unsigned int cpu)
> {
> const struct cpumask *smt_mask = cpu_smt_mask(cpu);
> - struct rq *rq = cpu_rq(cpu), *core_rq = NULL;
> + struct rq *rq = cpu_rq(cpu), *core_rq;
> int t;
>
> guard(core_lock)(&cpu);
Powered by blists - more mailing lists