bfs: fix Lockdep warning
[pandora-kernel.git] / mm / vmstat.c
index db9eabb..d7826af 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/err.h>
 #include <linux/module.h>
 #include <linux/cpu.h>
+#include <linux/vmstat.h>
 #include <linux/sched.h>
 
 #ifdef CONFIG_VM_EVENT_COUNTERS
@@ -26,7 +27,7 @@ static void sum_vm_events(unsigned long *ret, cpumask_t *cpumask)
 
        memset(ret, 0, NR_VM_EVENT_ITEMS * sizeof(unsigned long));
 
-       for_each_cpu_mask(cpu, *cpumask) {
+       for_each_cpu_mask_nr(cpu, *cpumask) {
                struct vm_event_state *this = &per_cpu(vm_event_states, cpu);
 
                for (i = 0; i < NR_VM_EVENT_ITEMS; i++)
@@ -515,9 +516,26 @@ static void pagetypeinfo_showblockcount_print(struct seq_file *m,
                        continue;
 
                page = pfn_to_page(pfn);
+#ifdef CONFIG_ARCH_FLATMEM_HAS_HOLES
+               /*
+                * Ordinarily, memory holes in flatmem still have a valid
+                * memmap for the PFN range. However, an architecture for
+                * embedded systems (e.g. ARM) can free up the memmap backing
+                * holes to save memory on the assumption the memmap is
+                * never used. The page_zone linkages are then broken even
+                * though pfn_valid() returns true. Skip the page if the
+                * linkages are broken. Even if this test passed, the impact
+                * is that the counters for the movable type are off but
+                * fragmentation monitoring is likely meaningless on small
+                * systems.
+                */
+               if (page_zone(page) != zone)
+                       continue;
+#endif
                mtype = get_pageblock_migratetype(page);
 
-               count[mtype]++;
+               if (mtype < MIGRATE_TYPES)
+                       count[mtype]++;
        }
 
        /* Print counts */