2019-06-01 10:08:49 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2008-07-26 04:46:07 +02:00
|
|
|
/*
|
|
|
|
* Generic show_mem() implementation
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/mm.h>
|
2014-12-19 01:17:21 +01:00
|
|
|
#include <linux/cma.h>
|
2008-07-26 04:46:07 +02:00
|
|
|
|
2017-02-23 00:46:16 +01:00
|
|
|
void show_mem(unsigned int filter, nodemask_t *nodemask)
|
2008-07-26 04:46:07 +02:00
|
|
|
{
|
|
|
|
pg_data_t *pgdat;
|
2013-11-13 00:08:15 +01:00
|
|
|
unsigned long total = 0, reserved = 0, highmem = 0;
|
2008-07-26 04:46:07 +02:00
|
|
|
|
2010-03-05 22:42:24 +01:00
|
|
|
printk("Mem-Info:\n");
|
2017-02-23 00:46:16 +01:00
|
|
|
show_free_areas(filter, nodemask);
|
2008-07-26 04:46:07 +02:00
|
|
|
|
|
|
|
for_each_online_pgdat(pgdat) {
|
2013-11-13 00:08:15 +01:00
|
|
|
int zoneid;
|
2008-07-26 04:46:07 +02:00
|
|
|
|
2013-11-13 00:08:15 +01:00
|
|
|
for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
|
|
|
|
struct zone *zone = &pgdat->node_zones[zoneid];
|
|
|
|
if (!populated_zone(zone))
|
2008-07-26 04:46:07 +02:00
|
|
|
continue;
|
|
|
|
|
2013-11-13 00:08:15 +01:00
|
|
|
total += zone->present_pages;
|
2018-12-28 09:34:24 +01:00
|
|
|
reserved += zone->present_pages - zone_managed_pages(zone);
|
2008-07-26 04:46:07 +02:00
|
|
|
|
2013-11-13 00:08:15 +01:00
|
|
|
if (is_highmem_idx(zoneid))
|
|
|
|
highmem += zone->present_pages;
|
2008-07-26 04:46:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-05 22:42:24 +01:00
|
|
|
printk("%lu pages RAM\n", total);
|
2013-11-13 00:08:15 +01:00
|
|
|
printk("%lu pages HighMem/MovableOnly\n", highmem);
|
2015-09-09 00:01:19 +02:00
|
|
|
printk("%lu pages reserved\n", reserved);
|
2014-12-19 01:17:21 +01:00
|
|
|
#ifdef CONFIG_CMA
|
|
|
|
printk("%lu pages cma reserved\n", totalcma_pages);
|
|
|
|
#endif
|
2014-01-22 00:50:57 +01:00
|
|
|
#ifdef CONFIG_MEMORY_FAILURE
|
|
|
|
printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
|
|
|
|
#endif
|
2008-07-26 04:46:07 +02:00
|
|
|
}
|