• Yong Wang's avatar
    mm, oom:dump_tasks add rss detailed information printing · 27873192
    Yong Wang authored
    When the system is under oom, it prints out the RSS information of each
    process.  However, we don't know the size of rss_anon, rss_file, and
    rss_shmem.
    
    To distinguish the memory occupied by anonymous or file mappings
    or shmem, could help us identify the root cause of the oom.
    
    So this patch adds RSS details, which refers to the /proc/<pid>/status[1].
    It can help us know more about process memory usage.
    
    Example of oom including the new rss_* fields:
    [ 1630.902466] Tasks state (memory values in pages):
    [ 1630.902870] [  pid  ]   uid  tgid total_vm      rss rss_anon rss_file rss_shmem pgtables_bytes swapents oom_score_adj name
    [ 1630.903619] [    149]     0   149      486      288        0      288         0    36864        0             0 ash
    [ 1630.904210] [    156]     0   156   153531   153345   153345        0         0  1269760        0             0 mm_test
    
    [1] commit 8cee852e ("mm, procfs: breakdown RSS for anon, shmem and file in /proc/pid/status").
    
    Link: https://lkml.kernel.org/r/202311231840181856667@zte.com.cnSigned-off-by: default avatarYong Wang <wang.yong12@zte.com.cn>
    Reviewed-by: default avatarYang Yang <yang.yang29@zte.com.cn>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Xuexin Jiang <jiang.xuexin@zte.com.cn>
    Cc: Michal Hocko <mhocko@suse.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    27873192
oom_kill.c 33.3 KB