Root/
Source at commit cdde9cf73945d547acd3e96f9508c79e84ad0bf1 created 12 years 9 months ago. By Maarten ter Huurne, MMC: JZ4740: Added support for CPU frequency changing | |
---|---|
1 | /* |
2 | * Common SMP CPU bringup/teardown functions |
3 | */ |
4 | #include <linux/err.h> |
5 | #include <linux/smp.h> |
6 | #include <linux/init.h> |
7 | #include <linux/sched.h> |
8 | #include <linux/percpu.h> |
9 | |
10 | #include "smpboot.h" |
11 | |
12 | #ifdef CONFIG_GENERIC_SMP_IDLE_THREAD |
13 | /* |
14 | * For the hotplug case we keep the task structs around and reuse |
15 | * them. |
16 | */ |
17 | static DEFINE_PER_CPU(struct task_struct *, idle_threads); |
18 | |
19 | struct task_struct * __cpuinit idle_thread_get(unsigned int cpu) |
20 | { |
21 | struct task_struct *tsk = per_cpu(idle_threads, cpu); |
22 | |
23 | if (!tsk) |
24 | return ERR_PTR(-ENOMEM); |
25 | init_idle(tsk, cpu); |
26 | return tsk; |
27 | } |
28 | |
29 | void __init idle_thread_set_boot_cpu(void) |
30 | { |
31 | per_cpu(idle_threads, smp_processor_id()) = current; |
32 | } |
33 | |
34 | /** |
35 | * idle_init - Initialize the idle thread for a cpu |
36 | * @cpu: The cpu for which the idle thread should be initialized |
37 | * |
38 | * Creates the thread if it does not exist. |
39 | */ |
40 | static inline void idle_init(unsigned int cpu) |
41 | { |
42 | struct task_struct *tsk = per_cpu(idle_threads, cpu); |
43 | |
44 | if (!tsk) { |
45 | tsk = fork_idle(cpu); |
46 | if (IS_ERR(tsk)) |
47 | pr_err("SMP: fork_idle() failed for CPU %u\n", cpu); |
48 | else |
49 | per_cpu(idle_threads, cpu) = tsk; |
50 | } |
51 | } |
52 | |
53 | /** |
54 | * idle_threads_init - Initialize idle threads for all cpus |
55 | */ |
56 | void __init idle_threads_init(void) |
57 | { |
58 | unsigned int cpu, boot_cpu; |
59 | |
60 | boot_cpu = smp_processor_id(); |
61 | |
62 | for_each_possible_cpu(cpu) { |
63 | if (cpu != boot_cpu) |
64 | idle_init(cpu); |
65 | } |
66 | } |
67 | #endif |
68 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9