Optimize timespec_trunc()
[powerpc.git] / kernel / sched.c
index a4ca632..0227f16 100644 (file)
@@ -4687,32 +4687,10 @@ out_unlock:
        return retval;
 }
 
-static inline struct task_struct *eldest_child(struct task_struct *p)
-{
-       if (list_empty(&p->children))
-               return NULL;
-       return list_entry(p->children.next,struct task_struct,sibling);
-}
-
-static inline struct task_struct *older_sibling(struct task_struct *p)
-{
-       if (p->sibling.prev==&p->parent->children)
-               return NULL;
-       return list_entry(p->sibling.prev,struct task_struct,sibling);
-}
-
-static inline struct task_struct *younger_sibling(struct task_struct *p)
-{
-       if (p->sibling.next==&p->parent->children)
-               return NULL;
-       return list_entry(p->sibling.next,struct task_struct,sibling);
-}
-
 static const char stat_nam[] = "RSDTtZX";
 
 static void show_task(struct task_struct *p)
 {
-       struct task_struct *relative;
        unsigned long free = 0;
        unsigned state;
 
@@ -4738,19 +4716,7 @@ static void show_task(struct task_struct *p)
                free = (unsigned long)n - (unsigned long)end_of_stack(p);
        }
 #endif
-       printk("%5lu %5d %6d ", free, p->pid, p->parent->pid);
-       if ((relative = eldest_child(p)))
-               printk("%5d ", relative->pid);
-       else
-               printk("      ");
-       if ((relative = younger_sibling(p)))
-               printk("%7d", relative->pid);
-       else
-               printk("       ");
-       if ((relative = older_sibling(p)))
-               printk(" %5d", relative->pid);
-       else
-               printk("      ");
+       printk("%5lu %5d %6d", free, p->pid, p->parent->pid);
        if (!p->mm)
                printk(" (L-TLB)\n");
        else
@@ -4780,7 +4746,7 @@ void show_state_filter(unsigned long state_filter)
                 * console might take alot of time:
                 */
                touch_nmi_watchdog();
-               if (p->state & state_filter)
+               if (!state_filter || (p->state & state_filter))
                        show_task(p);
        } while_each_thread(g, p);
 
@@ -5278,6 +5244,11 @@ int __init migration_init(void)
 #endif
 
 #ifdef CONFIG_SMP
+
+/* Number of possible processor ids */
+int nr_cpu_ids __read_mostly = NR_CPUS;
+EXPORT_SYMBOL(nr_cpu_ids);
+
 #undef SCHED_DOMAIN_DEBUG
 #ifdef SCHED_DOMAIN_DEBUG
 static void sched_domain_debug(struct sched_domain *sd, int cpu)
@@ -6760,6 +6731,7 @@ int in_sched_functions(unsigned long addr)
 void __init sched_init(void)
 {
        int i, j, k;
+       int highest_cpu = 0;
 
        for_each_possible_cpu(i) {
                struct prio_array *array;
@@ -6794,11 +6766,13 @@ void __init sched_init(void)
                        // delimiter for bitsearch
                        __set_bit(MAX_PRIO, array->bitmap);
                }
+               highest_cpu = i;
        }
 
        set_load_weight(&init_task);
 
 #ifdef CONFIG_SMP
+       nr_cpu_ids = highest_cpu + 1;
        open_softirq(SCHED_SOFTIRQ, run_rebalance_domains, NULL);
 #endif