On Sun, 2013-06-23 at 19:08 +0530, Srivatsa S. Bhat wrote: > The current CPU offline code uses stop_machine() internally. And disabling > preemption prevents stop_machine() from taking effect, thus also preventing > CPUs from going offline, as a side effect. > > There are places where this side-effect of preempt_disable() (or equivalent) > is used to synchronize with CPU hotplug. Typically these are in atomic > sections of code, where they can't make use of get/put_online_cpus(), because > the latter set of APIs can sleep. > > Going forward, we want to get rid of stop_machine() from the CPU hotplug > offline path. And then, with stop_machine() gone, disabling preemption will > no longer prevent CPUs from going offline. > > So provide a set of APIs for such atomic hotplug readers, to prevent (any) > CPUs from going offline. For now, they will default to preempt_disable() > and preempt_enable() itself, but this will help us do the tree-wide conversion, > as a preparatory step to remove stop_machine() from CPU hotplug. > > (Besides, it is good documentation as well, since it clearly marks places > where we synchronize with CPU hotplug, instead of combining it subtly with > disabling preemption). > > In future, when actually removing stop_machine(), we will alter the > implementation of these APIs to a suitable synchronization scheme. > > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > Cc: Tejun Heo <tj@xxxxxxxxxx> > Cc: "Rafael J. Wysocki" <rjw@xxxxxxx> > Cc: Yasuaki Ishimatsu <isimatu.yasuaki@xxxxxxxxxxxxxx> Reviewed-by: Steven Rostedt <rostedt@xxxxxxxxxxx> -- Steve > Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@xxxxxxxxxxxxxxxxxx> > --- > > include/linux/cpu.h | 18 ++++++++++++++++++ > kernel/cpu.c | 38 ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 56 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html