VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
31e12cb6792c8 (Thomas Gleixner     2019-06-01 10:08:49 +0200  1) // SPDX-License-Identifier: GPL-2.0-only
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700  2) /*
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700  3)  * Generic show_mem() implementation
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700  4)  *
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700  5)  * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de>
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700  6)  */
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700  7) 
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700  8) #include <linux/mm.h>
49abd8c28046a (Vishnu Pratap Singh 2014-12-18 16:17:21 -0800  9) #include <linux/cma.h>
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 10) 
9af744d743170 (Michal Hocko        2017-02-22 15:46:16 -0800 11) void show_mem(unsigned int filter, nodemask_t *nodemask)
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 12) {
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 13) 	pg_data_t *pgdat;
c78e93630d15b (Mel Gorman          2013-11-12 15:08:15 -0800 14) 	unsigned long total = 0, reserved = 0, highmem = 0;
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 15) 
f047f4f379234 (Amerigo Wang        2010-03-05 13:42:24 -0800 16) 	printk("Mem-Info:\n");
9af744d743170 (Michal Hocko        2017-02-22 15:46:16 -0800 17) 	show_free_areas(filter, nodemask);
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 18) 
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 19) 	for_each_online_pgdat(pgdat) {
c78e93630d15b (Mel Gorman          2013-11-12 15:08:15 -0800 20) 		int zoneid;
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 21) 
c78e93630d15b (Mel Gorman          2013-11-12 15:08:15 -0800 22) 		for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
c78e93630d15b (Mel Gorman          2013-11-12 15:08:15 -0800 23) 			struct zone *zone = &pgdat->node_zones[zoneid];
c78e93630d15b (Mel Gorman          2013-11-12 15:08:15 -0800 24) 			if (!populated_zone(zone))
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 25) 				continue;
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 26) 
c78e93630d15b (Mel Gorman          2013-11-12 15:08:15 -0800 27) 			total += zone->present_pages;
9705bea5f833f (Arun KS             2018-12-28 00:34:24 -0800 28) 			reserved += zone->present_pages - zone_managed_pages(zone);
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 29) 
c78e93630d15b (Mel Gorman          2013-11-12 15:08:15 -0800 30) 			if (is_highmem_idx(zoneid))
c78e93630d15b (Mel Gorman          2013-11-12 15:08:15 -0800 31) 				highmem += zone->present_pages;
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 32) 		}
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 33) 	}
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 34) 
f047f4f379234 (Amerigo Wang        2010-03-05 13:42:24 -0800 35) 	printk("%lu pages RAM\n", total);
c78e93630d15b (Mel Gorman          2013-11-12 15:08:15 -0800 36) 	printk("%lu pages HighMem/MovableOnly\n", highmem);
156408c0edaac (Vishnu Pratap Singh 2015-09-08 15:01:19 -0700 37) 	printk("%lu pages reserved\n", reserved);
49abd8c28046a (Vishnu Pratap Singh 2014-12-18 16:17:21 -0800 38) #ifdef CONFIG_CMA
49abd8c28046a (Vishnu Pratap Singh 2014-12-18 16:17:21 -0800 39) 	printk("%lu pages cma reserved\n", totalcma_pages);
49abd8c28046a (Vishnu Pratap Singh 2014-12-18 16:17:21 -0800 40) #endif
25487d73a9670 (Xishi Qiu           2014-01-21 15:50:57 -0800 41) #ifdef CONFIG_MEMORY_FAILURE
25487d73a9670 (Xishi Qiu           2014-01-21 15:50:57 -0800 42) 	printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
25487d73a9670 (Xishi Qiu           2014-01-21 15:50:57 -0800 43) #endif
454c63b02e530 (Johannes Weiner     2008-07-25 19:46:07 -0700 44) }