0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/mm.h>
0009 #include <linux/cma.h>
0010
0011 void show_mem(unsigned int filter, nodemask_t *nodemask)
0012 {
0013 pg_data_t *pgdat;
0014 unsigned long total = 0, reserved = 0, highmem = 0;
0015
0016 printk("Mem-Info:\n");
0017 show_free_areas(filter, nodemask);
0018
0019 for_each_online_pgdat(pgdat) {
0020 int zoneid;
0021
0022 for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
0023 struct zone *zone = &pgdat->node_zones[zoneid];
0024 if (!populated_zone(zone))
0025 continue;
0026
0027 total += zone->present_pages;
0028 reserved += zone->present_pages - zone_managed_pages(zone);
0029
0030 if (is_highmem_idx(zoneid))
0031 highmem += zone->present_pages;
0032 }
0033 }
0034
0035 printk("%lu pages RAM\n", total);
0036 printk("%lu pages HighMem/MovableOnly\n", highmem);
0037 printk("%lu pages reserved\n", reserved);
0038 #ifdef CONFIG_CMA
0039 printk("%lu pages cma reserved\n", totalcma_pages);
0040 #endif
0041 #ifdef CONFIG_MEMORY_FAILURE
0042 printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
0043 #endif
0044 }