diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-02 16:51:40 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-02 16:51:40 -0500 |
commit | 71f512e89704f5aa6fc0b97e4a719184080b8938 (patch) | |
tree | 91f855b3c03b9f1c5404e7901e6cb925e091004d /arch | |
parent | 7e86df273292b3a88c14b9aed1006cddac2b4c23 (diff) |
[ARM SMP] Track CPU idle threads
Track the idle thread task_struct for each CPU.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/kernel/smp.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 826164945747..45877f5d5717 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -80,19 +80,23 @@ static DEFINE_SPINLOCK(smp_call_function_lock); | |||
80 | 80 | ||
81 | int __cpuinit __cpu_up(unsigned int cpu) | 81 | int __cpuinit __cpu_up(unsigned int cpu) |
82 | { | 82 | { |
83 | struct task_struct *idle; | 83 | struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu); |
84 | struct task_struct *idle = ci->idle; | ||
84 | pgd_t *pgd; | 85 | pgd_t *pgd; |
85 | pmd_t *pmd; | 86 | pmd_t *pmd; |
86 | int ret; | 87 | int ret; |
87 | 88 | ||
88 | /* | 89 | /* |
89 | * Spawn a new process manually. Grab a pointer to | 90 | * Spawn a new process manually, if not already done. |
90 | * its task struct so we can mess with it | 91 | * Grab a pointer to its task struct so we can mess with it |
91 | */ | 92 | */ |
92 | idle = fork_idle(cpu); | 93 | if (!idle) { |
93 | if (IS_ERR(idle)) { | 94 | idle = fork_idle(cpu); |
94 | printk(KERN_ERR "CPU%u: fork() failed\n", cpu); | 95 | if (IS_ERR(idle)) { |
95 | return PTR_ERR(idle); | 96 | printk(KERN_ERR "CPU%u: fork() failed\n", cpu); |
97 | return PTR_ERR(idle); | ||
98 | } | ||
99 | ci->idle = idle; | ||
96 | } | 100 | } |
97 | 101 | ||
98 | /* | 102 | /* |
@@ -236,6 +240,8 @@ void __init smp_prepare_boot_cpu(void) | |||
236 | { | 240 | { |
237 | unsigned int cpu = smp_processor_id(); | 241 | unsigned int cpu = smp_processor_id(); |
238 | 242 | ||
243 | per_cpu(cpu_data, cpu).idle = current; | ||
244 | |||
239 | cpu_set(cpu, cpu_possible_map); | 245 | cpu_set(cpu, cpu_possible_map); |
240 | cpu_set(cpu, cpu_present_map); | 246 | cpu_set(cpu, cpu_present_map); |
241 | cpu_set(cpu, cpu_online_map); | 247 | cpu_set(cpu, cpu_online_map); |