]>
Commit | Line | Data |
---|---|---|
454c63b0 JW |
1 | /* |
2 | * Generic show_mem() implementation | |
3 | * | |
4 | * Copyright (C) 2008 Johannes Weiner <[email protected]> | |
5 | * All code subject to the GPL version 2. | |
6 | */ | |
7 | ||
8 | #include <linux/mm.h> | |
9 | #include <linux/nmi.h> | |
10 | #include <linux/quicklist.h> | |
11 | ||
b2b755b5 | 12 | void show_mem(unsigned int filter) |
454c63b0 JW |
13 | { |
14 | pg_data_t *pgdat; | |
c78e9363 | 15 | unsigned long total = 0, reserved = 0, highmem = 0; |
454c63b0 | 16 | |
f047f4f3 | 17 | printk("Mem-Info:\n"); |
7bf02ea2 | 18 | show_free_areas(filter); |
454c63b0 | 19 | |
4b59e6c4 DR |
20 | if (filter & SHOW_MEM_FILTER_PAGE_COUNT) |
21 | return; | |
22 | ||
454c63b0 | 23 | for_each_online_pgdat(pgdat) { |
c78e9363 MG |
24 | unsigned long flags; |
25 | int zoneid; | |
454c63b0 JW |
26 | |
27 | pgdat_resize_lock(pgdat, &flags); | |
c78e9363 MG |
28 | for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) { |
29 | struct zone *zone = &pgdat->node_zones[zoneid]; | |
30 | if (!populated_zone(zone)) | |
454c63b0 JW |
31 | continue; |
32 | ||
c78e9363 MG |
33 | total += zone->present_pages; |
34 | reserved = zone->present_pages - zone->managed_pages; | |
454c63b0 | 35 | |
c78e9363 MG |
36 | if (is_highmem_idx(zoneid)) |
37 | highmem += zone->present_pages; | |
454c63b0 JW |
38 | } |
39 | pgdat_resize_unlock(pgdat, &flags); | |
40 | } | |
41 | ||
f047f4f3 | 42 | printk("%lu pages RAM\n", total); |
c78e9363 | 43 | printk("%lu pages HighMem/MovableOnly\n", highmem); |
f047f4f3 | 44 | printk("%lu pages reserved\n", reserved); |
454c63b0 | 45 | #ifdef CONFIG_QUICKLIST |
f047f4f3 | 46 | printk("%lu pages in pagetable cache\n", |
454c63b0 JW |
47 | quicklist_total_size()); |
48 | #endif | |
49 | } |