Skip to content

Commit 68ad8df

Browse files
gormanmtorvalds
authored andcommitted
mm: print out the zonelists on request for manual verification
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>
1 parent 2dbb51c commit 68ad8df

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

‎mm/internal.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ do { \
8181
extern void mminit_verify_pageflags_layout(void);
8282
extern void mminit_verify_page_links(struct page *page,
8383
enum zone_type zone, unsigned long nid, unsigned long pfn);
84+
extern void mminit_verify_zonelist(void);
8485

8586
#else
8687

@@ -97,6 +98,10 @@ static inline void mminit_verify_page_links(struct page *page,
9798
enum zone_type zone, unsigned long nid, unsigned long pfn)
9899
{
99100
}
101+
102+
static inline void mminit_verify_zonelist(void)
103+
{
104+
}
100105
#endif /* CONFIG_DEBUG_MEMORY_INIT */
101106

102107
/* mminit_validate_memmodel_limits is independent of CONFIG_DEBUG_MEMORY_INIT */

‎mm/mm_init.c‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,51 @@
1111

1212
int __meminitdata mminit_loglevel;
1313

14+
/* The zonelists are simply reported, validation is manual. */
15+
void mminit_verify_zonelist(void)
16+
{
17+
int nid;
18+
19+
if (mminit_loglevel < MMINIT_VERIFY)
20+
return;
21+
22+
for_each_online_node(nid) {
23+
pg_data_t *pgdat = NODE_DATA(nid);
24+
struct zone *zone;
25+
struct zoneref *z;
26+
struct zonelist *zonelist;
27+
int i, listid, zoneid;
28+
29+
BUG_ON(MAX_ZONELISTS > 2);
30+
for (i = 0; i < MAX_ZONELISTS * MAX_NR_ZONES; i++) {
31+
32+
/* Identify the zone and nodelist */
33+
zoneid = i % MAX_NR_ZONES;
34+
listid = i / MAX_NR_ZONES;
35+
zonelist = &pgdat->node_zonelists[listid];
36+
zone = &pgdat->node_zones[zoneid];
37+
if (!populated_zone(zone))
38+
continue;
39+
40+
/* Print information about the zonelist */
41+
printk(KERN_DEBUG "mminit::zonelist %s %d:%s = ",
42+
listid > 0 ? "thisnode" : "general", nid,
43+
zone->name);
44+
45+
/* Iterate the zonelist */
46+
for_each_zone_zonelist(zone, z, zonelist, zoneid) {
47+
#ifdef CONFIG_NUMA
48+
printk(KERN_CONT "%d:%s ",
49+
zone->node, zone->name);
50+
#else
51+
printk(KERN_CONT "0:%s ", zone->name);
52+
#endif /* CONFIG_NUMA */
53+
}
54+
printk(KERN_CONT "\n");
55+
}
56+
}
57+
}
58+
1459
void __init mminit_verify_pageflags_layout(void)
1560
{
1661
int shift, width;

‎mm/page_alloc.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,6 +2352,7 @@ void build_all_zonelists(void)
23522352

23532353
if (system_state == SYSTEM_BOOTING) {
23542354
__build_all_zonelists(NULL);
2355+
mminit_verify_zonelist();
23552356
cpuset_init_current_mems_allowed();
23562357
} else {
23572358
/* we have to stop all cpus to guarantee there is no user

0 commit comments

Comments
 (0)