Line data Source code
1 : // SPDX-License-Identifier: GPL-2.0-only 2 : /* 3 : * Generic show_mem() implementation 4 : * 5 : * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de> 6 : */ 7 : 8 : #include <linux/mm.h> 9 : #include <linux/cma.h> 10 : 11 0 : void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx) 12 : { 13 0 : unsigned long total = 0, reserved = 0, highmem = 0; 14 : struct zone *zone; 15 : 16 0 : printk("Mem-Info:\n"); 17 0 : __show_free_areas(filter, nodemask, max_zone_idx); 18 : 19 0 : for_each_populated_zone(zone) { 20 : 21 0 : total += zone->present_pages; 22 0 : reserved += zone->present_pages - zone_managed_pages(zone); 23 : 24 0 : if (is_highmem(zone)) 25 : highmem += zone->present_pages; 26 : } 27 : 28 0 : printk("%lu pages RAM\n", total); 29 0 : printk("%lu pages HighMem/MovableOnly\n", highmem); 30 0 : printk("%lu pages reserved\n", reserved); 31 : #ifdef CONFIG_CMA 32 : printk("%lu pages cma reserved\n", totalcma_pages); 33 : #endif 34 : #ifdef CONFIG_MEMORY_FAILURE 35 : printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages)); 36 : #endif 37 0 : }