diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2012-04-20 09:05:45 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2012-04-26 06:06:09 -0400 |
commit | 29d5e0476e1c4a513859e7858845ad172f560389 (patch) | |
tree | b353eee6e4cdf57207e6eba5d80564a4e8811cc9 /kernel/smpboot.h | |
parent | 38498a67aa2cf8c80754b8d304bfacc10bc582b5 (diff) |
smp: Provide generic idle thread allocation
All SMP architectures have magic to fork the idle task and to store it
for reusage when cpu hotplug is enabled. Provide a generic
infrastructure for it.
Create/reinit the idle thread for the cpu which is brought up in the
generic code and hand the thread pointer to the architecture code via
__cpu_up().
Note, that fork_idle() is called via a workqueue, because this
guarantees that the idle thread does not get a reference to a user
space VM. This can happen when the boot process did not bring up all
possible cpus and a later cpu_up() is initiated via the sysfs
interface. In that case fork_idle() would be called in the context of
the user space task and take a reference on the user space VM.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Howells <dhowells@redhat.com>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: x86@kernel.org
Acked-by: Venkatesh Pallipadi <venki@google.com>
Link: http://lkml.kernel.org/r/20120420124557.102478630@linutronix.de
Diffstat (limited to 'kernel/smpboot.h')
-rw-r--r-- | kernel/smpboot.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/smpboot.h b/kernel/smpboot.h index d88e77165086..7943bbbab917 100644 --- a/kernel/smpboot.h +++ b/kernel/smpboot.h | |||
@@ -1,6 +1,16 @@ | |||
1 | #ifndef SMPBOOT_H | 1 | #ifndef SMPBOOT_H |
2 | #define SMPBOOT_H | 2 | #define SMPBOOT_H |
3 | 3 | ||
4 | struct task_struct; | ||
5 | |||
4 | int smpboot_prepare(unsigned int cpu); | 6 | int smpboot_prepare(unsigned int cpu); |
5 | 7 | ||
8 | #ifdef CONFIG_GENERIC_SMP_IDLE_THREAD | ||
9 | struct task_struct *idle_thread_get(unsigned int cpu); | ||
10 | void idle_thread_set_boot_cpu(void); | ||
11 | #else | ||
12 | static inline struct task_struct *idle_thread_get(unsigned int cpu) { return NULL; } | ||
13 | static inline void idle_thread_set_boot_cpu(void) { } | ||
14 | #endif | ||
15 | |||
6 | #endif | 16 | #endif |