Re: [patch 1/3] tick: Remove pointless cpu valid check in hotplug code
From: Frederic Weisbecker
Date: Fri Dec 11 2020 - 20:22:17 EST
On Sat, Dec 12, 2020 at 01:16:12AM +0100, Thomas Gleixner wrote:
> On Fri, Dec 11 2020 at 23:21, Frederic Weisbecker wrote:
> > On Sun, Dec 06, 2020 at 10:12:54PM +0100, Thomas Gleixner wrote:
> >> tick_handover_do_timer() which is invoked when a CPU is unplugged has a
> >> @@ -407,17 +407,13 @@ EXPORT_SYMBOL_GPL(tick_broadcast_oneshot
> >> /*
> >> * Transfer the do_timer job away from a dying cpu.
> >> *
> >> - * Called with interrupts disabled. Not locking required. If
> >> + * Called with interrupts disabled. No locking required. If
> >> * tick_do_timer_cpu is owned by this cpu, nothing can change it.
> >> */
> >> void tick_handover_do_timer(void)
> >> {
> >> - if (tick_do_timer_cpu == smp_processor_id()) {
> >> - int cpu = cpumask_first(cpu_online_mask);
> >> -
> >> - tick_do_timer_cpu = (cpu < nr_cpu_ids) ? cpu :
> >> - TICK_DO_TIMER_NONE;
> >> - }
> >> + if (tick_do_timer_cpu == smp_processor_id())
> >> + tick_do_timer_cpu = cpumask_first(cpu_online_mask);
> >
> > I was about to whine that this randomly chosen CPU may be idle and leave
> > the timekeeping stale until I realized that stop_machine() is running at that
> > time. Might be worth adding a comment about that.
> >
> > Also why not just setting it to TICK_DO_TIMER_NONE and be done with it? Perhaps
> > to avoid that all the CPUs to compete and contend on jiffies update after stop
> > machine?
>
> No. Because we'd need to add the NONE magic to NOHZ=n kernels which does
> not make sense.
I forgot about that other half of the world.
Thanks.