mm: print out the zonelists on request for manual verification
authorMel Gorman <mel@csn.ul.ie>
Thu, 24 Jul 2008 04:26:52 +0000 (21:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:14 +0000 (10:47 -0700)
This patch prints out the zonelists during boot for manual verification by the
user if the mminit_loglevel is MMINIT_VERIFY or higher.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/internal.h
mm/mm_init.c
mm/page_alloc.c

index 5d17f3efac41be4d7e33c404764ac52b65b902eb..50807e12490ed41c762e859ced22b16f76828f92 100644 (file)
@@ -81,6 +81,7 @@ do { \
 extern void mminit_verify_pageflags_layout(void);
 extern void mminit_verify_page_links(struct page *page,
                enum zone_type zone, unsigned long nid, unsigned long pfn);
+extern void mminit_verify_zonelist(void);
 
 #else
 
@@ -97,6 +98,10 @@ static inline void mminit_verify_page_links(struct page *page,
                enum zone_type zone, unsigned long nid, unsigned long pfn)
 {
 }
+
+static inline void mminit_verify_zonelist(void)
+{
+}
 #endif /* CONFIG_DEBUG_MEMORY_INIT */
 
 /* mminit_validate_memmodel_limits is independent of CONFIG_DEBUG_MEMORY_INIT */
index e16990d629e66849a1d2780325356fd4dd1d45da..ce445ca097e7986b44ade72193dcf93dc3915194 100644 (file)
 
 int __meminitdata mminit_loglevel;
 
+/* The zonelists are simply reported, validation is manual. */
+void mminit_verify_zonelist(void)
+{
+       int nid;
+
+       if (mminit_loglevel < MMINIT_VERIFY)
+               return;
+
+       for_each_online_node(nid) {
+               pg_data_t *pgdat = NODE_DATA(nid);
+               struct zone *zone;
+               struct zoneref *z;
+               struct zonelist *zonelist;
+               int i, listid, zoneid;
+
+               BUG_ON(MAX_ZONELISTS > 2);
+               for (i = 0; i < MAX_ZONELISTS * MAX_NR_ZONES; i++) {
+
+                       /* Identify the zone and nodelist */
+                       zoneid = i % MAX_NR_ZONES;
+                       listid = i / MAX_NR_ZONES;
+                       zonelist = &pgdat->node_zonelists[listid];
+                       zone = &pgdat->node_zones[zoneid];
+                       if (!populated_zone(zone))
+                               continue;
+
+                       /* Print information about the zonelist */
+                       printk(KERN_DEBUG "mminit::zonelist %s %d:%s = ",
+                               listid > 0 ? "thisnode" : "general", nid,
+                               zone->name);
+
+                       /* Iterate the zonelist */
+                       for_each_zone_zonelist(zone, z, zonelist, zoneid) {
+#ifdef CONFIG_NUMA
+                               printk(KERN_CONT "%d:%s ",
+                                       zone->node, zone->name);
+#else
+                               printk(KERN_CONT "0:%s ", zone->name);
+#endif /* CONFIG_NUMA */
+                       }
+                       printk(KERN_CONT "\n");
+               }
+       }
+}
+
 void __init mminit_verify_pageflags_layout(void)
 {
        int shift, width;
index 0adb66e711e665188010e6f32f7b1478a1a103de..9ece07ce65b0353ab26093e3a37dbb41e7ae8818 100644 (file)
@@ -2352,6 +2352,7 @@ void build_all_zonelists(void)
 
        if (system_state == SYSTEM_BOOTING) {
                __build_all_zonelists(NULL);
+               mminit_verify_zonelist();
                cpuset_init_current_mems_allowed();
        } else {
                /* we have to stop all cpus to guarantee there is no user