Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / arch / ia64 / kernel / topology.c
index 4f3a16b..5629b45 100644 (file)
@@ -13,7 +13,6 @@
  *     Populate cpu cache entries in sysfs for cpu cache info
  */
 
-#include <linux/config.h>
 #include <linux/cpu.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <asm/numa.h>
 #include <asm/cpu.h>
 
-#ifdef CONFIG_NUMA
-static struct node *sysfs_nodes;
-#endif
 static struct ia64_cpu *sysfs_cpus;
 
 int arch_register_cpu(int num)
 {
-       struct node *parent = NULL;
-       
-#ifdef CONFIG_NUMA
-       parent = &sysfs_nodes[cpu_to_node(num)];
-#endif /* CONFIG_NUMA */
-
 #if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU)
        /*
         * If CPEI cannot be re-targetted, and this is
@@ -46,23 +36,18 @@ int arch_register_cpu(int num)
         */
        if (!can_cpei_retarget() && is_cpu_cpei_target(num))
                sysfs_cpus[num].cpu.no_control = 1;
+       map_cpu_to_node(num, node_cpuid[num].nid);
 #endif
 
-       return register_cpu(&sysfs_cpus[num].cpu, num, parent);
+       return register_cpu(&sysfs_cpus[num].cpu, num);
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
 
 void arch_unregister_cpu(int num)
 {
-       struct node *parent = NULL;
-
-#ifdef CONFIG_NUMA
-       int node = cpu_to_node(num);
-       parent = &sysfs_nodes[node];
-#endif /* CONFIG_NUMA */
-
-       return unregister_cpu(&sysfs_cpus[num].cpu, parent);
+       unregister_cpu(&sysfs_cpus[num].cpu);
+       unmap_cpu_from_node(num, cpu_to_node(num));
 }
 EXPORT_SYMBOL(arch_register_cpu);
 EXPORT_SYMBOL(arch_unregister_cpu);
@@ -74,26 +59,18 @@ static int __init topology_init(void)
        int i, err = 0;
 
 #ifdef CONFIG_NUMA
-       sysfs_nodes = kzalloc(sizeof(struct node) * MAX_NUMNODES, GFP_KERNEL);
-       if (!sysfs_nodes) {
-               err = -ENOMEM;
-               goto out;
-       }
-
        /*
         * MCD - Do we want to register all ONLINE nodes, or all POSSIBLE nodes?
         */
        for_each_online_node(i) {
-               if ((err = register_node(&sysfs_nodes[i], i, 0)))
+               if ((err = register_one_node(i)))
                        goto out;
        }
 #endif
 
        sysfs_cpus = kzalloc(sizeof(struct ia64_cpu) * NR_CPUS, GFP_KERNEL);
-       if (!sysfs_cpus) {
-               err = -ENOMEM;
-               goto out;
-       }
+       if (!sysfs_cpus)
+               panic("kzalloc in topology_init failed - NR_CPUS too big?");
 
        for_each_present_cpu(i) {
                if((err = arch_register_cpu(i)))
@@ -166,7 +143,7 @@ static void cache_shared_cpu_map_setup( unsigned int cpu,
 
        num_shared = (int) csi.num_shared;
        do {
-               for_each_cpu(j)
+               for_each_possible_cpu(j)
                        if (cpu_data(cpu)->socket_id == cpu_data(j)->socket_id
                                && cpu_data(j)->core_id == csi.log1_cid
                                && cpu_data(j)->thread_id == csi.log1_tid)
@@ -426,7 +403,7 @@ static int __cpuinit cache_remove_dev(struct sys_device * sys_dev)
  * When a cpu is hot-plugged, do a check and initiate
  * cache kobject if necessary
  */
-static int cache_cpu_callback(struct notifier_block *nfb,
+static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,
                unsigned long action, void *hcpu)
 {
        unsigned int cpu = (unsigned long)hcpu;
@@ -444,7 +421,7 @@ static int cache_cpu_callback(struct notifier_block *nfb,
        return NOTIFY_OK;
 }
 
-static struct notifier_block cache_cpu_notifier =
+static struct notifier_block __cpuinitdata cache_cpu_notifier =
 {
        .notifier_call = cache_cpu_callback
 };
@@ -458,7 +435,7 @@ static int __cpuinit cache_sysfs_init(void)
                                (void *)(long)i);
        }
 
-       register_cpu_notifier(&cache_cpu_notifier);
+       register_hotcpu_notifier(&cache_cpu_notifier);
 
        return 0;
 }