• Rafael Aquini's avatar
    mm: export NR_SHMEM via sysinfo(2) / si_meminfo() interfaces · cc7452b6
    Rafael Aquini authored
    Historically, we exported shared pages to userspace via sysinfo(2)
    sharedram and /proc/meminfo's "MemShared" fields.  With the advent of
    tmpfs, from kernel v2.4 onward, that old way for accounting shared mem
    was deemed inaccurate and we started to export a hard-coded 0 for
    sysinfo.sharedram.  Later on, during the 2.6 timeframe, "MemShared" got
    re-introduced to /proc/meminfo re-branded as "Shmem", but we're still
    reporting sysinfo.sharedmem as that old hard-coded zero, which makes the
    "shared memory" report inconsistent across interfaces.
    
    This patch leverages the addition of explicit accounting for pages used
    by shmem/tmpfs -- "4b02108a mm: oom analysis: add shmem vmstat" -- in
    order to make the users of sysinfo(2) and si_meminfo*() friends aware of
    that vmstat entry and make them report it consistently across the
    interfaces, as well to make sysinfo(2) returned data consistent with our
    current API documentation states.
    Signed-off-by: default avatarRafael Aquini <aquini@redhat.com>
    Acked-by: default avatarRik van Riel <riel@redhat.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: Hugh Dickins <hughd@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    cc7452b6
node.c 18.6 KB