2 * Generic show_mem() implementation
4 * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de>
5 * All code subject to the GPL version 2.
10 #include <linux/quicklist.h>
15 unsigned long total
= 0, reserved
= 0, shared
= 0,
16 nonshared
= 0, highmem
= 0;
18 printk(KERN_INFO
"Mem-Info:\n");
21 for_each_online_pgdat(pgdat
) {
22 unsigned long i
, flags
;
24 pgdat_resize_lock(pgdat
, &flags
);
25 for (i
= 0; i
< pgdat
->node_spanned_pages
; i
++) {
27 unsigned long pfn
= pgdat
->node_start_pfn
+ i
;
29 if (unlikely(!(i
% MAX_ORDER_NR_PAGES
)))
35 page
= pfn_to_page(pfn
);
37 if (PageHighMem(page
))
40 if (PageReserved(page
))
42 else if (page_count(page
) == 1)
44 else if (page_count(page
) > 1)
45 shared
+= page_count(page
) - 1;
49 pgdat_resize_unlock(pgdat
, &flags
);
52 printk(KERN_INFO
"%lu pages RAM\n", total
);
54 printk(KERN_INFO
"%lu pages HighMem\n", highmem
);
56 printk(KERN_INFO
"%lu pages reserved\n", reserved
);
57 printk(KERN_INFO
"%lu pages shared\n", shared
);
58 printk(KERN_INFO
"%lu pages non-shared\n", nonshared
);
59 #ifdef CONFIG_QUICKLIST
60 printk(KERN_INFO
"%lu pages in pagetable cache\n",
61 quicklist_total_size());