swap: redirty page if page write fails on swap file
[deliverable/linux.git] / mm / page_alloc.c
index b54c5cbf0200bffdd688b0e4c31fcce6e1f56e54..98cbdf6e553217a87b62daac80d26c026ecf60e3 100644 (file)
@@ -4187,10 +4187,23 @@ int __meminit __early_pfn_to_nid(unsigned long pfn)
 {
        unsigned long start_pfn, end_pfn;
        int i, nid;
+       /*
+        * NOTE: The following SMP-unsafe globals are only used early in boot
+        * when the kernel is running single-threaded.
+        */
+       static unsigned long __meminitdata last_start_pfn, last_end_pfn;
+       static int __meminitdata last_nid;
+
+       if (last_start_pfn <= pfn && pfn < last_end_pfn)
+               return last_nid;
 
        for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid)
-               if (start_pfn <= pfn && pfn < end_pfn)
+               if (start_pfn <= pfn && pfn < end_pfn) {
+                       last_start_pfn = start_pfn;
+                       last_end_pfn = end_pfn;
+                       last_nid = nid;
                        return nid;
+               }
        /* This is a memory hole */
        return -1;
 }
@@ -4736,7 +4749,7 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
 /*
  * Figure out the number of possible node ids.
  */
-static void __init setup_nr_node_ids(void)
+void __init setup_nr_node_ids(void)
 {
        unsigned int node;
        unsigned int highest = 0;
@@ -4745,10 +4758,6 @@ static void __init setup_nr_node_ids(void)
                highest = node;
        nr_node_ids = highest + 1;
 }
-#else
-static inline void setup_nr_node_ids(void)
-{
-}
 #endif
 
 /**
This page took 0.026588 seconds and 5 git commands to generate.