Commit 71f512e8 authored by Russell King's avatar Russell King Committed by Russell King

[ARM SMP] Track CPU idle threads

Track the idle thread task_struct for each CPU.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 7e86df27
...@@ -80,19 +80,23 @@ static DEFINE_SPINLOCK(smp_call_function_lock); ...@@ -80,19 +80,23 @@ static DEFINE_SPINLOCK(smp_call_function_lock);
int __cpuinit __cpu_up(unsigned int cpu) int __cpuinit __cpu_up(unsigned int cpu)
{ {
struct task_struct *idle; struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu);
struct task_struct *idle = ci->idle;
pgd_t *pgd; pgd_t *pgd;
pmd_t *pmd; pmd_t *pmd;
int ret; int ret;
/* /*
* Spawn a new process manually. Grab a pointer to * Spawn a new process manually, if not already done.
* its task struct so we can mess with it * Grab a pointer to its task struct so we can mess with it
*/ */
idle = fork_idle(cpu); if (!idle) {
if (IS_ERR(idle)) { idle = fork_idle(cpu);
printk(KERN_ERR "CPU%u: fork() failed\n", cpu); if (IS_ERR(idle)) {
return PTR_ERR(idle); printk(KERN_ERR "CPU%u: fork() failed\n", cpu);
return PTR_ERR(idle);
}
ci->idle = idle;
} }
/* /*
...@@ -236,6 +240,8 @@ void __init smp_prepare_boot_cpu(void) ...@@ -236,6 +240,8 @@ void __init smp_prepare_boot_cpu(void)
{ {
unsigned int cpu = smp_processor_id(); unsigned int cpu = smp_processor_id();
per_cpu(cpu_data, cpu).idle = current;
cpu_set(cpu, cpu_possible_map); cpu_set(cpu, cpu_possible_map);
cpu_set(cpu, cpu_present_map); cpu_set(cpu, cpu_present_map);
cpu_set(cpu, cpu_online_map); cpu_set(cpu, cpu_online_map);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
struct cpuinfo_arm { struct cpuinfo_arm {
struct cpu cpu; struct cpu cpu;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
struct task_struct *idle;
unsigned int loops_per_jiffy; unsigned int loops_per_jiffy;
#endif #endif
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment