pid namespaces: define is_global_init() and is_container_init()
[linux-2.6.git] / arch / alpha / mm / numa.c
index ba81c44..e3e3806 100644 (file)
@@ -6,19 +6,21 @@
  *  Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
 #include <linux/swap.h>
 #include <linux/initrd.h>
+#include <linux/pfn.h>
+#include <linux/module.h>
 
 #include <asm/hwrpb.h>
 #include <asm/pgalloc.h>
 
 pg_data_t node_data[MAX_NUMNODES];
 bootmem_data_t node_bdata[MAX_NUMNODES];
+EXPORT_SYMBOL(node_data);
 
 #undef DEBUG_DISCONTIG
 #ifdef DEBUG_DISCONTIG
@@ -27,9 +29,6 @@ bootmem_data_t node_bdata[MAX_NUMNODES];
 #define DBGDCONT(args...)
 #endif
 
-#define PFN_UP(x)       (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
-#define PFN_DOWN(x)     ((x) >> PAGE_SHIFT)
-#define PFN_PHYS(x)     ((x) << PAGE_SHIFT)
 #define for_each_mem_cluster(memdesc, cluster, i)              \
        for ((cluster) = (memdesc)->cluster, (i) = 0;           \
             (i) < (memdesc)->numclusters; (i)++, (cluster)++)
@@ -327,8 +326,6 @@ void __init mem_init(void)
        extern char _text, _etext, _data, _edata;
        extern char __init_begin, __init_end;
        unsigned long nid, i;
-       struct page * lmem_map;
-
        high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
 
        reservedpages = 0;
@@ -338,10 +335,10 @@ void __init mem_init(void)
                 */
                totalram_pages += free_all_bootmem_node(NODE_DATA(nid));
 
-               lmem_map = node_mem_map(nid);
                pfn = NODE_DATA(nid)->node_start_pfn;
                for (i = 0; i < node_spanned_pages(nid); i++, pfn++)
-                       if (page_is_ram(pfn) && PageReserved(lmem_map+i))
+                       if (page_is_ram(pfn) &&
+                           PageReserved(nid_page_nr(nid, i)))
                                reservedpages++;
        }
 
@@ -373,19 +370,22 @@ show_mem(void)
        show_free_areas();
        printk("Free swap:       %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
        for_each_online_node(nid) {
-               struct page * lmem_map = node_mem_map(nid);
+               unsigned long flags;
+               pgdat_resize_lock(NODE_DATA(nid), &flags);
                i = node_spanned_pages(nid);
                while (i-- > 0) {
+                       struct page *page = nid_page_nr(nid, i);
                        total++;
-                       if (PageReserved(lmem_map+i))
+                       if (PageReserved(page))
                                reserved++;
-                       else if (PageSwapCache(lmem_map+i))
+                       else if (PageSwapCache(page))
                                cached++;
-                       else if (!page_count(lmem_map+i))
+                       else if (!page_count(page))
                                free++;
                        else
-                               shared += page_count(lmem_map + i) - 1;
+                               shared += page_count(page) - 1;
                }
+               pgdat_resize_unlock(NODE_DATA(nid), &flags);
        }
        printk("%ld pages of RAM\n",total);
        printk("%ld free pages\n",free);