Back to home page

LXR

 
 

    


0001 /*
0002  * Generic show_mem() implementation
0003  *
0004  * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de>
0005  * All code subject to the GPL version 2.
0006  */
0007 
0008 #include <linux/mm.h>
0009 #include <linux/quicklist.h>
0010 #include <linux/cma.h>
0011 
0012 void show_mem(unsigned int filter)
0013 {
0014     pg_data_t *pgdat;
0015     unsigned long total = 0, reserved = 0, highmem = 0;
0016 
0017     printk("Mem-Info:\n");
0018     show_free_areas(filter);
0019 
0020     for_each_online_pgdat(pgdat) {
0021         unsigned long flags;
0022         int zoneid;
0023 
0024         pgdat_resize_lock(pgdat, &flags);
0025         for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
0026             struct zone *zone = &pgdat->node_zones[zoneid];
0027             if (!populated_zone(zone))
0028                 continue;
0029 
0030             total += zone->present_pages;
0031             reserved += zone->present_pages - zone->managed_pages;
0032 
0033             if (is_highmem_idx(zoneid))
0034                 highmem += zone->present_pages;
0035         }
0036         pgdat_resize_unlock(pgdat, &flags);
0037     }
0038 
0039     printk("%lu pages RAM\n", total);
0040     printk("%lu pages HighMem/MovableOnly\n", highmem);
0041     printk("%lu pages reserved\n", reserved);
0042 #ifdef CONFIG_CMA
0043     printk("%lu pages cma reserved\n", totalcma_pages);
0044 #endif
0045 #ifdef CONFIG_QUICKLIST
0046     printk("%lu pages in pagetable cache\n",
0047         quicklist_total_size());
0048 #endif
0049 #ifdef CONFIG_MEMORY_FAILURE
0050     printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
0051 #endif
0052 }