Merge branch 'bfin_rotary' into next
[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>
9#include <linux/nmi.h>
10#include <linux/quicklist.h>
49abd8c2 11#include <linux/cma.h>
454c63b0 12
b2b755b5 13void show_mem(unsigned int filter)
454c63b0
JW
14{
15 pg_data_t *pgdat;
c78e9363 16 unsigned long total = 0, reserved = 0, highmem = 0;
454c63b0 17
f047f4f3 18 printk("Mem-Info:\n");
7bf02ea2 19 show_free_areas(filter);
454c63b0
JW
20
21 for_each_online_pgdat(pgdat) {
c78e9363
MG
22 unsigned long flags;
23 int zoneid;
454c63b0
JW
24
25 pgdat_resize_lock(pgdat, &flags);
c78e9363
MG
26 for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
27 struct zone *zone = &pgdat->node_zones[zoneid];
28 if (!populated_zone(zone))
454c63b0
JW
29 continue;
30
c78e9363 31 total += zone->present_pages;
bc127bda 32 reserved += zone->present_pages - zone->managed_pages;
454c63b0 33
c78e9363
MG
34 if (is_highmem_idx(zoneid))
35 highmem += zone->present_pages;
454c63b0
JW
36 }
37 pgdat_resize_unlock(pgdat, &flags);
38 }
39
f047f4f3 40 printk("%lu pages RAM\n", total);
c78e9363 41 printk("%lu pages HighMem/MovableOnly\n", highmem);
49abd8c2
VPS
42#ifdef CONFIG_CMA
43 printk("%lu pages reserved\n", (reserved - totalcma_pages));
44 printk("%lu pages cma reserved\n", totalcma_pages);
45#else
f047f4f3 46 printk("%lu pages reserved\n", reserved);
49abd8c2 47#endif
454c63b0 48#ifdef CONFIG_QUICKLIST
f047f4f3 49 printk("%lu pages in pagetable cache\n",
454c63b0
JW
50 quicklist_total_size());
51#endif
25487d73
XQ
52#ifdef CONFIG_MEMORY_FAILURE
53 printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
54#endif
454c63b0 55}