blob: 09225796991a83a9281194d855719021b8b18282 [file] [log] [blame]
Johannes Weiner454c63b2008-07-25 19:46:07 -07001/*
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
David Rientjesb2b755b2011-03-24 15:18:15 -070012void show_mem(unsigned int filter)
Johannes Weiner454c63b2008-07-25 19:46:07 -070013{
14 pg_data_t *pgdat;
Mel Gormanc78e9362013-11-12 15:08:15 -080015 unsigned long total = 0, reserved = 0, highmem = 0;
Johannes Weiner454c63b2008-07-25 19:46:07 -070016
Amerigo Wangf047f4f2010-03-05 13:42:24 -080017 printk("Mem-Info:\n");
David Rientjes7bf02ea2011-05-24 17:11:16 -070018 show_free_areas(filter);
Johannes Weiner454c63b2008-07-25 19:46:07 -070019
20 for_each_online_pgdat(pgdat) {
Mel Gormanc78e9362013-11-12 15:08:15 -080021 unsigned long flags;
22 int zoneid;
Johannes Weiner454c63b2008-07-25 19:46:07 -070023
24 pgdat_resize_lock(pgdat, &flags);
Mel Gormanc78e9362013-11-12 15:08:15 -080025 for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
26 struct zone *zone = &pgdat->node_zones[zoneid];
27 if (!populated_zone(zone))
Johannes Weiner454c63b2008-07-25 19:46:07 -070028 continue;
29
Mel Gormanc78e9362013-11-12 15:08:15 -080030 total += zone->present_pages;
31 reserved = zone->present_pages - zone->managed_pages;
Johannes Weiner454c63b2008-07-25 19:46:07 -070032
Mel Gormanc78e9362013-11-12 15:08:15 -080033 if (is_highmem_idx(zoneid))
34 highmem += zone->present_pages;
Johannes Weiner454c63b2008-07-25 19:46:07 -070035 }
36 pgdat_resize_unlock(pgdat, &flags);
37 }
38
Amerigo Wangf047f4f2010-03-05 13:42:24 -080039 printk("%lu pages RAM\n", total);
Mel Gormanc78e9362013-11-12 15:08:15 -080040 printk("%lu pages HighMem/MovableOnly\n", highmem);
Amerigo Wangf047f4f2010-03-05 13:42:24 -080041 printk("%lu pages reserved\n", reserved);
Johannes Weiner454c63b2008-07-25 19:46:07 -070042#ifdef CONFIG_QUICKLIST
Amerigo Wangf047f4f2010-03-05 13:42:24 -080043 printk("%lu pages in pagetable cache\n",
Johannes Weiner454c63b2008-07-25 19:46:07 -070044 quicklist_total_size());
45#endif
Xishi Qiu25487d72014-01-21 15:50:57 -080046#ifdef CONFIG_MEMORY_FAILURE
47 printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
48#endif
Johannes Weiner454c63b2008-07-25 19:46:07 -070049}