extern unsigned long shrink_all_memory(unsigned long nr_pages);
 extern int vm_swappiness;
 extern int remove_mapping(struct address_space *mapping, struct page *page);
+extern long vm_total_pages;
 
 #ifdef CONFIG_NUMA
 extern int zone_reclaim_mode;
 
                stop_machine_run(__build_all_zonelists, NULL, NR_CPUS);
                /* cpuset refresh routine should be here */
        }
-
-       printk("Built %i zonelists\n", num_online_nodes());
-
+       vm_total_pages = nr_free_pagecache_pages();
+       printk("Built %i zonelists.  Total pages: %ld\n",
+                       num_online_nodes(), vm_total_pages);
 }
 
 /*
 
  * From 0 .. 100.  Higher means more swappy.
  */
 int vm_swappiness = 60;
-static long total_memory;
+long vm_total_pages;   /* The total number of pages which the VM controls */
 
 static LIST_HEAD(shrinker_list);
 static DECLARE_RWSEM(shrinker_rwsem);
                 * how much memory
                 * is mapped.
                 */
-               mapped_ratio = (sc->nr_mapped * 100) / total_memory;
+               mapped_ratio = (sc->nr_mapped * 100) / vm_total_pages;
 
                /*
                 * Now decide how much we really want to unmap some pages.  The
                pgdat->kswapd = find_task_by_pid(pid);
                read_unlock(&tasklist_lock);
        }
-       total_memory = nr_free_pagecache_pages();
        hotcpu_notifier(cpu_callback, 0);
        return 0;
 }