2019-06-01 11:08:49 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2008-07-26 06:46:07 +04:00
|
|
|
/*
|
|
|
|
* Generic show_mem() implementation
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/mm.h>
|
2014-12-19 03:17:21 +03:00
|
|
|
#include <linux/cma.h>
|
2008-07-26 06:46:07 +04:00
|
|
|
|
2022-08-23 12:22:30 +03:00
|
|
|
void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
|
2008-07-26 06:46:07 +04:00
|
|
|
{
|
2013-11-13 03:08:15 +04:00
|
|
|
unsigned long total = 0, reserved = 0, highmem = 0;
|
2023-04-17 06:52:26 +03:00
|
|
|
struct zone *zone;
|
2008-07-26 06:46:07 +04:00
|
|
|
|
2010-03-06 00:42:24 +03:00
|
|
|
printk("Mem-Info:\n");
|
2022-08-23 12:22:30 +03:00
|
|
|
__show_free_areas(filter, nodemask, max_zone_idx);
|
2008-07-26 06:46:07 +04:00
|
|
|
|
2023-04-17 06:52:26 +03:00
|
|
|
for_each_populated_zone(zone) {
|
2008-07-26 06:46:07 +04:00
|
|
|
|
2023-04-17 06:52:26 +03:00
|
|
|
total += zone->present_pages;
|
|
|
|
reserved += zone->present_pages - zone_managed_pages(zone);
|
2008-07-26 06:46:07 +04:00
|
|
|
|
2023-04-17 06:52:26 +03:00
|
|
|
if (is_highmem(zone))
|
|
|
|
highmem += zone->present_pages;
|
2008-07-26 06:46:07 +04:00
|
|
|
}
|
|
|
|
|
2010-03-06 00:42:24 +03:00
|
|
|
printk("%lu pages RAM\n", total);
|
2013-11-13 03:08:15 +04:00
|
|
|
printk("%lu pages HighMem/MovableOnly\n", highmem);
|
2015-09-09 01:01:19 +03:00
|
|
|
printk("%lu pages reserved\n", reserved);
|
2014-12-19 03:17:21 +03:00
|
|
|
#ifdef CONFIG_CMA
|
|
|
|
printk("%lu pages cma reserved\n", totalcma_pages);
|
|
|
|
#endif
|
2014-01-22 03:50:57 +04:00
|
|
|
#ifdef CONFIG_MEMORY_FAILURE
|
|
|
|
printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
|
|
|
|
#endif
|
2008-07-26 06:46:07 +04:00
|
|
|
}
|