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>
12 void show_mem(unsigned int filter
)
15 unsigned long total
= 0, reserved
= 0, shared
= 0,
16 nonshared
= 0, highmem
= 0;
18 printk("Mem-Info:\n");
19 show_free_areas(filter
);
21 if (filter
& SHOW_MEM_FILTER_PAGE_COUNT
)
24 for_each_online_pgdat(pgdat
) {
25 unsigned long i
, flags
;
27 pgdat_resize_lock(pgdat
, &flags
);
28 for (i
= 0; i
< pgdat
->node_spanned_pages
; i
++) {
30 unsigned long pfn
= pgdat
->node_start_pfn
+ i
;
32 if (unlikely(!(i
% MAX_ORDER_NR_PAGES
)))
38 page
= pfn_to_page(pfn
);
40 if (PageHighMem(page
))
43 if (PageReserved(page
))
45 else if (page_count(page
) == 1)
47 else if (page_count(page
) > 1)
48 shared
+= page_count(page
) - 1;
52 pgdat_resize_unlock(pgdat
, &flags
);
55 printk("%lu pages RAM\n", total
);
57 printk("%lu pages HighMem\n", highmem
);
59 printk("%lu pages reserved\n", reserved
);
60 printk("%lu pages shared\n", shared
);
61 printk("%lu pages non-shared\n", nonshared
);
62 #ifdef CONFIG_QUICKLIST
63 printk("%lu pages in pagetable cache\n",
64 quicklist_total_size());