printk: Don't allow cpu to get console lock during hotplugging
The flush of the console takes unnecessary time during the cpu
hotplug up operation. It can delay the rcu synchronize_sched
operation, which in turn delays the hotplug operation. The flush
delays rcu synchronize_sched during scheduling domain creation
by up to 100 ms by interrupting the move to a quiescent state.
This change delays the flush of the console to later in the
notification chain of cpu_online. At the point in the cpu_up
operation where the flush now occurs, other tasks can already
be scheduled on the cpu that just came up.
Signed-off-by: Maya Spivak <mspivak@codeaurora.org>
diff --git a/kernel/printk.c b/kernel/printk.c
index ff1a52c..ccdfac7 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -817,6 +817,11 @@
*/
static inline int can_use_console(unsigned int cpu)
{
+#ifdef CONFIG_HOTPLUG_CPU
+ if (!cpu_active(cpu) && cpu_hotplug_inprogress())
+ return 0;
+#endif
+
return cpu_online(cpu) || have_callable_console();
}