public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] stop_machine: make stop_machine safe and efficient to call early
@ 2011-09-30 16:28 Jeremy Fitzhardinge
  2011-09-30 16:34 ` Steven Rostedt
  2011-09-30 23:06 ` Tejun Heo
  0 siblings, 2 replies; 9+ messages in thread
From: Jeremy Fitzhardinge @ 2011-09-30 16:28 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Rusty Russell, Peter Zijlstra, Andrew Morton, Ingo Molnar,
	Steven Rostedt, Linux Kernel Mailing List, H. Peter Anvin

Make stop_machine() safe to call early in boot, before SMP has been
set up, by simply calling the callback function directly if there's
only one CPU online.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index ba5070c..2df15ca 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -485,6 +485,9 @@ int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus)
 					    .num_threads = num_online_cpus(),
 					    .active_cpus = cpus };
 
+	if (smdata.num_threads == 1)
+		return (*fn)(data);
+
 	/* Set the initial state and stop all online cpus. */
 	set_state(&smdata, STOPMACHINE_PREPARE);
 	return stop_cpus(cpu_online_mask, stop_machine_cpu_stop, &smdata);



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-09-30 23:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-30 16:28 [PATCH RFC] stop_machine: make stop_machine safe and efficient to call early Jeremy Fitzhardinge
2011-09-30 16:34 ` Steven Rostedt
2011-09-30 17:00   ` Jeremy Fitzhardinge
2011-09-30 21:06     ` Andrew Morton
2011-09-30 21:21       ` Steven Rostedt
2011-09-30 21:23   ` Andrew Morton
2011-09-30 23:06 ` Tejun Heo
2011-09-30 23:32   ` Jeremy Fitzhardinge
2011-09-30 23:39     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox