Disable "maybe-uninitialized" warning globally
[linux-2.6-block.git] / lib / show_mem.c
CommitLineData
454c63b0
JW
1/*
2 * Generic show_mem() implementation
3 *
4 * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de>
5 * All code subject to the GPL version 2.
6 */
7
8#include <linux/mm.h>
454c63b0 9#include <linux/quicklist.h>
49abd8c2 10#include <linux/cma.h>
454c63b0 11
b2b755b5 12void show_mem(unsigned int filter)
454c63b0
JW
13{
14 pg_data_t *pgdat;
c78e9363 15 unsigned long total = 0, reserved = 0, highmem = 0;
454c63b0 16
f047f4f3 17 printk("Mem-Info:\n");
7bf02ea2 18 show_free_areas(filter);
454c63b0
JW
19
20 for_each_online_pgdat(pgdat) {
c78e9363
MG
21 unsigned long flags;
22 int zoneid;
454c63b0
JW
23
24 pgdat_resize_lock(pgdat, &flags);
c78e9363
MG
25 for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
26 struct zone *zone = &pgdat->node_zones[zoneid];
27 if (!populated_zone(zone))
454c63b0
JW
28 continue;
29
c78e9363 30 total += zone->present_pages;
bc127bda 31 reserved += zone->present_pages - zone->managed_pages;
454c63b0 32
c78e9363
MG
33 if (is_highmem_idx(zoneid))
34 highmem += zone->present_pages;
454c63b0
JW
35 }
36 pgdat_resize_unlock(pgdat, &flags);
37 }
38
f047f4f3 39 printk("%lu pages RAM\n", total);
c78e9363 40 printk("%lu pages HighMem/MovableOnly\n", highmem);
156408c0 41 printk("%lu pages reserved\n", reserved);
49abd8c2 42#ifdef CONFIG_CMA
49abd8c2 43 printk("%lu pages cma reserved\n", totalcma_pages);
49abd8c2 44#endif
454c63b0 45#ifdef CONFIG_QUICKLIST
f047f4f3 46 printk("%lu pages in pagetable cache\n",
454c63b0
JW
47 quicklist_total_size());
48#endif
25487d73
XQ
49#ifdef CONFIG_MEMORY_FAILURE
50 printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
51#endif
454c63b0 52}