vserver 1.9.5.x5
[linux-2.6.git] / arch / mips / sgi-ip27 / ip27-klnuma.c
index b5e86ad..41c3f40 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/init.h>
 #include <linux/mmzone.h>
 #include <linux/kernel.h>
+#include <linux/nodemask.h>
 #include <linux/string.h>
 
 #include <asm/page.h>
@@ -19,7 +20,6 @@
 #include <asm/sn/mapped_kernel.h>
 #include <asm/sn/sn_private.h>
 
-extern char _end;
 static cpumask_t ktext_repmask;
 
 /*
@@ -27,33 +27,25 @@ static cpumask_t ktext_repmask;
  * kernel.  For example, we should never put a copy on a headless node,
  * and we should respect the topology of the machine.
  */
-void __init setup_replication_mask(int maxnodes)
+void __init setup_replication_mask()
 {
-       static int      numa_kernel_replication_ratio;
        cnodeid_t       cnode;
 
        /* Set only the master cnode's bit.  The master cnode is always 0. */
        cpus_clear(ktext_repmask);
        cpu_set(0, ktext_repmask);
 
-       numa_kernel_replication_ratio = 0;
 #ifdef CONFIG_REPLICATE_KTEXT
 #ifndef CONFIG_MAPPED_KERNEL
 #error Kernel replication works with mapped kernel support. No calias support.
 #endif
-       numa_kernel_replication_ratio = 1;
-#endif
-
-       for (cnode = 1; cnode < numnodes; cnode++) {
-               /* See if this node should get a copy of the kernel */
-               if (numa_kernel_replication_ratio &&
-                   !(cnode % numa_kernel_replication_ratio)) {
-
-                       /* Advertise that we have a copy of the kernel */
-                       cpu_set(cnode, ktext_repmask);
-               }
+       for_each_online_node(cnode) {
+               if (cnode == 0)
+                       continue;
+               /* Advertise that we have a copy of the kernel */
+               cpu_set(cnode, ktext_repmask);
        }
-
+#endif
        /* Set up a GDA pointer to the replication mask. */
        GDA->g_ktext_repmask = &ktext_repmask;
 }
@@ -61,12 +53,12 @@ void __init setup_replication_mask(int maxnodes)
 
 static __init void set_ktext_source(nasid_t client_nasid, nasid_t server_nasid)
 {
-       kern_vars_t *kvp;
        cnodeid_t client_cnode;
+       kern_vars_t *kvp;
 
        client_cnode = NASID_TO_COMPACT_NODEID(client_nasid);
 
-       kvp = &(HUB_DATA(client_nasid)->kern_vars);
+       kvp = &hub_data(client_nasid)->kern_vars;
 
        KERN_VARS_ADDR(client_nasid) = (unsigned long)kvp;
 
@@ -92,7 +84,7 @@ static __init void copy_kernel(nasid_t dest_nasid)
        memcpy((void *)dest_kern_start, (void *)source_start, kern_size);
 }
 
-void __init replicate_kernel_text(int maxnodes)
+void __init replicate_kernel_text()
 {
        cnodeid_t cnode;
        nasid_t client_nasid;
@@ -103,7 +95,9 @@ void __init replicate_kernel_text(int maxnodes)
        /* Record where the master node should get its kernel text */
        set_ktext_source(master_nasid, master_nasid);
 
-       for (cnode = 1; cnode < maxnodes; cnode++) {
+       for_each_online_node(cnode) {
+               if (cnode == 0)
+                       continue;
                client_nasid = COMPACT_TO_NASID_NODEID(cnode);
 
                /* Check if this node should get a copy of the kernel */
@@ -124,12 +118,12 @@ void __init replicate_kernel_text(int maxnodes)
  */
 pfn_t node_getfirstfree(cnodeid_t cnode)
 {
-       unsigned long loadbase = CKSEG0;
+       unsigned long loadbase = REP_BASE;
        nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
        unsigned long offset;
 
 #ifdef CONFIG_MAPPED_KERNEL
-       loadbase = CKSSEG + 16777216;
+       loadbase += 16777216;
 #endif
        offset = PAGE_ALIGN((unsigned long)(&_end)) - loadbase;
        if ((cnode == 0) || (cpu_isset(cnode, ktext_repmask)))