Re: [PATCH v2 1/1] wq: Avoid using isolated cpus' timers on queue_delayed_work

From: Frederic Weisbecker
Date: Fri Apr 05 2024 - 18:04:00 EST


Le Fri, Apr 05, 2024 at 05:38:54AM -1000, Tejun Heo a écrit :
> > > > > So it seems that we should fix housekeeping_setup() ? see the patch below.
> > > > >
> > > > > In any case the usage of cpu_present_mask doesn't look right to me.
> > > > >
> > > > > Oleg.
> > > > >
> > > > > --- a/kernel/sched/isolation.c
> > > > > +++ b/kernel/sched/isolation.c
> > > > > @@ -129,7 +154,7 @@ static int __init housekeeping_setup(char *str, unsigned long flags)
> > > > > cpumask_andnot(housekeeping_staging,
> > > > > cpu_possible_mask, non_housekeeping_mask);
> > > > >
> > > > > - if (!cpumask_intersects(cpu_present_mask, housekeeping_staging)) {
> > > > > + if (!cpumask_test_cpu(smp_processor_id(), housekeeping_staging)) {
> > > > > __cpumask_set_cpu(smp_processor_id(), housekeeping_staging);
> > > > > __cpumask_clear_cpu(smp_processor_id(), non_housekeeping_mask);
> > > > > if (!housekeeping.flags) {
>
> Ensuring the boot CPU always be a housekeeping CPU makes sense to me but I'm
> not very familiar with the housekeeping code. Frederic, what do you think?

I vote for reverting:

08ae95f4fd3b (nohz_full: Allow the boot CPU to be nohz_full)

And if that's not possible because there are actual users of it, then
the best we can do is to make housekeeping_any_cpu() return smp_processor_id()
if the housekeeping_mask() is empty. Or rather if the housekeeping_mask is
empty, return cpumask_of(smp_processor_id()).

Of course that's merely just a bandaid.

Thanks.