zram: use __bio_add_page for adding single page to bio
[linux-block.git] / lib / show_mem.c
CommitLineData
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
974f4367 11void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
454c63b0 12{
c78e9363 13 unsigned long total = 0, reserved = 0, highmem = 0;
13215e8a 14 struct zone *zone;
454c63b0 15
f047f4f3 16 printk("Mem-Info:\n");
974f4367 17 __show_free_areas(filter, nodemask, max_zone_idx);
454c63b0 18
13215e8a 19 for_each_populated_zone(zone) {
454c63b0 20
13215e8a
YD
21 total += zone->present_pages;
22 reserved += zone->present_pages - zone_managed_pages(zone);
454c63b0 23
13215e8a
YD
24 if (is_highmem(zone))
25 highmem += zone->present_pages;
454c63b0
JW
26 }
27
f047f4f3 28 printk("%lu pages RAM\n", total);
c78e9363 29 printk("%lu pages HighMem/MovableOnly\n", highmem);
156408c0 30 printk("%lu pages reserved\n", reserved);
49abd8c2 31#ifdef CONFIG_CMA
49abd8c2 32 printk("%lu pages cma reserved\n", totalcma_pages);
49abd8c2 33#endif
25487d73
XQ
34#ifdef CONFIG_MEMORY_FAILURE
35 printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
36#endif
454c63b0 37}