Introduce print_mem_usage to print the result of analysis of /proc/kcore. The page number of memory in different use are printed. Signed-off-by: Baoquan He <bhe at redhat.com> --- makedumpfile.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/makedumpfile.c b/makedumpfile.c index b67ede1..a170dd3 100644 --- a/makedumpfile.c +++ b/makedumpfile.c @@ -7830,6 +7830,46 @@ print_report(void) REPORT_MSG("\n"); } +static void +print_mem_usage(void) +{ + mdf_pfn_t pfn_original, pfn_excluded, shrinking; + + /* + * /proc/vmcore doesn't contain the memory hole area. + */ + pfn_original = info->max_mapnr - pfn_memhole; + + pfn_excluded = pfn_zero + pfn_cache + pfn_cache_private + + pfn_user + pfn_free + pfn_hwpoison; + shrinking = (pfn_original - pfn_excluded) * 100; + shrinking = shrinking / pfn_original; + + MSG("\n"); + MSG("Page number of memory in different use\n"); + MSG("--------------------------------------------------\n"); + MSG("TYPE PAGES EXCLUDABLE DESCRIPTION\n"); + + MSG("pfn_zero 0x%016llx yes Pages filled with zero\n", pfn_zero); + MSG("pfn_cache 0x%016llx yes Cache pages\n", pfn_cache); + MSG("pfn_cache_private 0x%016llx yes Cache pages + private\n", + pfn_cache_private); + MSG("pfn_user 0x%016llx yes User process data pages\n", pfn_user); + MSG("pfn_free 0x%016llx yes Free pages\n", pfn_free); + MSG("pfn_hwpoison 0x%016llx yes Hwpoison pages\n", pfn_hwpoison); + MSG("pfn_kernel_data 0x%016llx no Dumpable kernel data \n", + pfn_original - pfn_excluded); + + MSG("\n"); + + MSG("Total pages on system: 0x%016llx\n", pfn_original); + MSG("Excludable pages: 0x%016llx\n", pfn_excluded); + MSG("Memory Hole: 0x%016llx\n", pfn_memhole); + MSG("--------------------------------------------------\n"); + MSG("Total pages: 0x%016llx\n", info->max_mapnr); + MSG("\n"); +} + int writeout_dumpfile(void) { -- 1.8.4.2