Commit | Line | Data |
---|---|---|
31e12cb6 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
454c63b0 JW |
2 | /* |
3 | * Generic show_mem() implementation | |
4 | * | |
5 | * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de> | |
454c63b0 JW |
6 | */ |
7 | ||
8 | #include <linux/mm.h> | |
49abd8c2 | 9 | #include <linux/cma.h> |
454c63b0 | 10 | |
9af744d7 | 11 | void show_mem(unsigned int filter, nodemask_t *nodemask) |
454c63b0 JW |
12 | { |
13 | pg_data_t *pgdat; | |
c78e9363 | 14 | unsigned long total = 0, reserved = 0, highmem = 0; |
454c63b0 | 15 | |
f047f4f3 | 16 | printk("Mem-Info:\n"); |
9af744d7 | 17 | show_free_areas(filter, nodemask); |
454c63b0 JW |
18 | |
19 | for_each_online_pgdat(pgdat) { | |
c78e9363 | 20 | int zoneid; |
454c63b0 | 21 | |
c78e9363 MG |
22 | for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) { |
23 | struct zone *zone = &pgdat->node_zones[zoneid]; | |
24 | if (!populated_zone(zone)) | |
454c63b0 JW |
25 | continue; |
26 | ||
c78e9363 | 27 | total += zone->present_pages; |
9705bea5 | 28 | reserved += zone->present_pages - zone_managed_pages(zone); |
454c63b0 | 29 | |
c78e9363 MG |
30 | if (is_highmem_idx(zoneid)) |
31 | highmem += zone->present_pages; | |
454c63b0 | 32 | } |
454c63b0 JW |
33 | } |
34 | ||
f047f4f3 | 35 | printk("%lu pages RAM\n", total); |
c78e9363 | 36 | printk("%lu pages HighMem/MovableOnly\n", highmem); |
156408c0 | 37 | printk("%lu pages reserved\n", reserved); |
49abd8c2 | 38 | #ifdef CONFIG_CMA |
49abd8c2 | 39 | printk("%lu pages cma reserved\n", totalcma_pages); |
49abd8c2 | 40 | #endif |
25487d73 XQ |
41 | #ifdef CONFIG_MEMORY_FAILURE |
42 | printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages)); | |
43 | #endif | |
454c63b0 | 44 | } |