• Zhenliang Wei's avatar
    tools/vm/page_owner_sort.c: count and sort by mem · f7df2b1c
    Zhenliang Wei authored
    When viewing page owner information, we may be more concerned about the
    total memory rather than the times of stack appears.  Therefore, the
    following adjustments are made:
    
    1. Added the statistics on the total number of pages.
    
    2. Added the optional parameter "-m" to configure the program to sort by
       memory (total pages).
    
    The general output of page_owner is as follows:
    
    	Page allocated via order XXX, ...
    	PFN XXX ...
    	 // Detailed stack
    
    	Page allocated via order XXX, ...
    	PFN XXX ...
    	 // Detailed stack
    
    The original page_owner_sort ignores PFN rows, puts the remaining rows
    in buf, counts the times of buf, and finally sorts them according to the
    times.  General output:
    
    	XXX times:
    	Page allocated via order XXX, ...
    	 // Detailed stack
    
    Now, we use regexp to extract the page order value from the buf, and
    count the total pages for the buf.  General output:
    
    	XXX times, XXX pages:
    	Page allocated via order XXX, ...
    	 // Detailed stack
    
    By default, it is still sorted by the times of buf; If you want to sort
    by the pages nums of buf, use the new -m parameter.
    
    Link: https://lkml.kernel.org/r/1631678242-41033-1-git-send-email-weizhenliang@huawei.comSigned-off-by: default avatarZhenliang Wei <weizhenliang@huawei.com>
    Cc: Tang Bin <tangbin@cmss.chinamobile.com>
    Cc: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
    Cc: Zhenliang Wei <weizhenliang@huawei.com>
    Cc: Xiaoming Ni <nixiaoming@huawei.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    f7df2b1c
page_owner.rst 4.39 KB