Merge tag 'mfd-3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd...
[platform/adaptation/renesas_rcar/renesas_kernel.git] / lib / show_mem.c
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>
11
12 void show_mem(unsigned int filter)
13 {
14         pg_data_t *pgdat;
15         unsigned long total = 0, reserved = 0, highmem = 0;
16
17         printk("Mem-Info:\n");
18         show_free_areas(filter);
19
20         if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
21                 return;
22
23         for_each_online_pgdat(pgdat) {
24                 unsigned long flags;
25                 int zoneid;
26
27                 pgdat_resize_lock(pgdat, &flags);
28                 for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
29                         struct zone *zone = &pgdat->node_zones[zoneid];
30                         if (!populated_zone(zone))
31                                 continue;
32
33                         total += zone->present_pages;
34                         reserved = zone->present_pages - zone->managed_pages;
35
36                         if (is_highmem_idx(zoneid))
37                                 highmem += zone->present_pages;
38                 }
39                 pgdat_resize_unlock(pgdat, &flags);
40         }
41
42         printk("%lu pages RAM\n", total);
43         printk("%lu pages HighMem/MovableOnly\n", highmem);
44         printk("%lu pages reserved\n", reserved);
45 #ifdef CONFIG_QUICKLIST
46         printk("%lu pages in pagetable cache\n",
47                 quicklist_total_size());
48 #endif
49 }