[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <PH0PR11MB58804706BEA2ADC92FD86C21DAA09@PH0PR11MB5880.namprd11.prod.outlook.com>
Date: Thu, 16 Feb 2023 06:07:51 +0000
From: "Zhang, Qiang1" <qiang1.zhang@...el.com>
To: Joel Fernandes <joel@...lfernandes.org>
CC: "mingo@...hat.com" <mingo@...hat.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"juri.lelli@...hat.com" <juri.lelli@...hat.com>,
"paulmck@...nel.org" <paulmck@...nel.org>,
"frederic@...nel.org" <frederic@...nel.org>,
"rcu@...r.kernel.org" <rcu@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2] sched/isolation: Fix illegal CPU value by
housekeeping_any_cpu() return
>
> For kernels built with CONFIG_NO_HZ_FULL=y, running the following tests:
>
[...]
> This commit therefore add checks for cpumask_any_and() return values
> in housekeeping_any_cpu(), if cpumask_any_and() returns an illegal CPU
> value, the housekeeping_any_cpu() will return current CPU number.
>
> Signed-off-by: Zqiang <qiang1.zhang@...el.com>
> ---
> kernel/sched/isolation.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
> index 373d42c707bc..534397ab7a36 100644
> --- a/kernel/sched/isolation.c
> +++ b/kernel/sched/isolation.c
> @@ -46,7 +46,11 @@ int housekeeping_any_cpu(enum hk_type type)
> if (cpu < nr_cpu_ids)
> return cpu;
>
> - return cpumask_any_and(housekeeping.cpumasks[type], cpu_online_mask);
> + cpu = cpumask_any_and(housekeeping.cpumasks[type], cpu_online_mask);
> + if (cpu >= nr_cpu_ids)
> + return smp_processor_id();
> + else
> + return cpu;
>
>Nit: no need of "else", simply:
>
>return (cpu >= nr_cpuids ? smp_processor_id() : cpu);
Thanks Joel, I have done the same modification in v3 version, and this change is
also related to a 08ae95f4fd3b, after revert it, this calltrace will disappear.
Thanks
Zqiang
>
>or
>
>if (cpu >= nr_cpu_ids)
> return smp_processor_id();
>return cpu;
>
>Thanks.
Powered by blists - more mailing lists