Re: [PATCH V3] cpu/hotplug: Cache number of online CPUs

From: Mathieu Desnoyers
Date: Tue Jul 09 2019 - 11:52:22 EST


----- On Jul 9, 2019, at 10:23 AM, Thomas Gleixner tglx@xxxxxxxxxxxxx wrote:
[...]
> +void set_cpu_online(unsigned int cpu, bool online)
> +{
> + /*
> + * atomic_inc/dec() is required to handle the horrid abuse of this
> + * function by the reboot and kexec code which invokes it from

invokes -> invoke

> + * IPI/NMI broadcasts when shutting down CPUs. Inocation from

Inocation -> Invocation

The rest looks good!

Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>

> + * regular CPU hotplug is properly serialized.
> + *
> + * Note, that the fact that __num_online_cpus is of type atomic_t
> + * does not protect readers which are not serialized against
> + * concurrent hotplug operations.
> + */
> + if (online) {
> + if (!cpumask_test_and_set_cpu(cpu, &__cpu_online_mask))
> + atomic_inc(&__num_online_cpus);
> + } else {
> + if (cpumask_test_and_clear_cpu(cpu, &__cpu_online_mask))
> + atomic_dec(&__num_online_cpus);
> + }
> +}
> +
> /*
> * Activate the first processor.
> */

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com