Re: [PATCH -tip/core/rcu 2/6] Introduce cpu_notifier() to handle !HOTPLUG_CPU case

Josh Triplett
2009-08-17T17:21:43Z

On Sat, 2009-08-15 at 09:53 -0700, Paul E. McKenney wrote:
> From: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>
> This patch introduces a new cpu_notifier() API that is similar to
> hotcpu_notifier(), but which also notifies of CPUs coming online during
> boot in the !HOTPLUG_CPU case.
[...]
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -48,6 +48,15 @@ struct notifier_block;
>
> #ifdef CONFIG_SMP
> /* Need to know about CPUs going up/down? */
> +#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
> +#define cpu_notifier(fn, pri) { \
> + static struct notifier_block fn##_nb __cpuinitdata = \
> + { .notifier_call = fn, .priority = pri }; \
> + register_cpu_notifier(&fn##_nb); \
> +}
> +#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
> +#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
> +#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */

These two definitions seem inconsistent. I think the first one needs to
change to use do { ... } while(0) as well, so it eats the subsequent
semicolon.

Does this really want to live under defined(CONFIG_HOTPLUG_CPU)? What
happens when onlining CPUs during the !define(CONFIG_HOTPLUG_CPU) case?
This seems somewhat inconsistent with the explanation in your commit
message; can you clarify?

Also, why !defined(MODULE)?

- Josh Triplett