]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM SMP] Track CPU idle threads
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Wed, 2 Nov 2005 21:51:40 +0000 (21:51 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 2 Nov 2005 21:51:40 +0000 (21:51 +0000)
Track the idle thread task_struct for each CPU.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/smp.c
include/asm-arm/cpu.h

index 826164945747523fa93712d9d0575051b511ccb7..45877f5d5717e2580570af7494528bbacaea4e02 100644 (file)
@@ -80,19 +80,23 @@ static DEFINE_SPINLOCK(smp_call_function_lock);
 
 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;
        pmd_t *pmd;
        int ret;
 
        /*
-        * Spawn a new process manually.  Grab a pointer to
-        * its task struct so we can mess with it
+        * Spawn a new process manually, if not already done.
+        * Grab a pointer to its task struct so we can mess with it
         */
-       idle = fork_idle(cpu);
-       if (IS_ERR(idle)) {
-               printk(KERN_ERR "CPU%u: fork() failed\n", cpu);
-               return PTR_ERR(idle);
+       if (!idle) {
+               idle = fork_idle(cpu);
+               if (IS_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)
 {
        unsigned int cpu = smp_processor_id();
 
+       per_cpu(cpu_data, cpu).idle = current;
+
        cpu_set(cpu, cpu_possible_map);
        cpu_set(cpu, cpu_present_map);
        cpu_set(cpu, cpu_online_map);
index fcbdd40cb66773da5638c8f640877bec2140b890..751bc7462074fab8f617ba2c66fc4da19e61b92b 100644 (file)
@@ -16,6 +16,7 @@
 struct cpuinfo_arm {
        struct cpu      cpu;
 #ifdef CONFIG_SMP
+       struct task_struct *idle;
        unsigned int    loops_per_jiffy;
 #endif
 };