On Thu, Feb 9, 2023 at 6:55 PM Zqiang <qiang1.zhang@xxxxxxxxx> wrote: > > 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@xxxxxxxxx> > --- > 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); or if (cpu >= nr_cpu_ids) return smp_processor_id(); return cpu; Thanks.