On Wed, Jan 18, 2023 at 10:37:08PM +0000, Joel Fernandes wrote: > > That's a great idea. I found a way to do that without having to do the > EXPORT_SYMBOL (like in Zhouyi's patch). > > Would the following be acceptable (only build-tested)? > > I can run more tests and submit a patch: > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > index 55405ebf23ab..f73bc520b70e 100644 > --- a/drivers/base/cpu.c > +++ b/drivers/base/cpu.c > @@ -487,7 +487,8 @@ static const struct attribute_group *cpu_root_attr_groups[] = { > bool cpu_is_hotpluggable(unsigned int cpu) > { > struct device *dev = get_cpu_device(cpu); > - return dev && container_of(dev, struct cpu, dev)->hotpluggable; > + return dev && container_of(dev, struct cpu, dev)->hotpluggable > + && !tick_nohz_cpu_hotpluggable(cpu); > } > EXPORT_SYMBOL_GPL(cpu_is_hotpluggable); > > diff --git a/include/linux/tick.h b/include/linux/tick.h > index bfd571f18cfd..9459fef5b857 100644 > --- a/include/linux/tick.h > +++ b/include/linux/tick.h > @@ -216,6 +216,7 @@ extern void tick_nohz_dep_set_signal(struct task_struct *tsk, > enum tick_dep_bits bit); > extern void tick_nohz_dep_clear_signal(struct signal_struct *signal, > enum tick_dep_bits bit); > +extern bool tick_nohz_cpu_hotpluggable(unsigned int cpu); > > /* > * The below are tick_nohz_[set,clear]_dep() wrappers that optimize off-cases > @@ -280,6 +281,7 @@ static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { } > > static inline void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit) { } > static inline void tick_nohz_dep_clear_cpu(int cpu, enum tick_dep_bits bit) { } > +static inline bool tick_nohz_cpu_hotpluggable(unsigned int cpu) { return true; } > > static inline void tick_dep_set(enum tick_dep_bits bit) { } > static inline void tick_dep_clear(enum tick_dep_bits bit) { } > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c > index 9c6f661fb436..d1cc7525240e 100644 > --- a/kernel/time/tick-sched.c > +++ b/kernel/time/tick-sched.c > @@ -522,6 +522,11 @@ static int tick_nohz_cpu_down(unsigned int cpu) > return 0; > } > > +bool tick_nohz_cpu_hotpluggable(unsigned int cpu) > +{ > + return tick_nohz_cpu_down(cpu) == 0; > +} > + Can you make it the opposite? Have tick_nohz_cpu_down() call tick_nohz_cpu_hotpluggable()? To avoid future accidents. Thanks. > void __init tick_nohz_init(void) > { > int cpu, ret; > -- > 2.39.0.246.g2a6d74b583-goog >