The patch titled Subject: mm: export NR_SHMEM via sysinfo(2) / si_meminfo() interfaces has been added to the -mm tree. Its filename is mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Rafael Aquini <aquini@xxxxxxxxxx> Subject: mm: export NR_SHMEM via sysinfo(2) / si_meminfo() interfaces 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 -- "4b02108 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: Rafael Aquini <aquini@xxxxxxxxxx> Acked-by: Rik van Riel <riel@xxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/base/node.c | 2 +- fs/proc/meminfo.c | 2 +- mm/page_alloc.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff -puN drivers/base/node.c~mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces drivers/base/node.c --- a/drivers/base/node.c~mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces +++ a/drivers/base/node.c @@ -126,7 +126,7 @@ static ssize_t node_read_meminfo(struct nid, K(node_page_state(nid, NR_FILE_PAGES)), nid, K(node_page_state(nid, NR_FILE_MAPPED)), nid, K(node_page_state(nid, NR_ANON_PAGES)), - nid, K(node_page_state(nid, NR_SHMEM)), + nid, K(i.sharedram), nid, node_page_state(nid, NR_KERNEL_STACK) * THREAD_SIZE / 1024, nid, K(node_page_state(nid, NR_PAGETABLE)), diff -puN fs/proc/meminfo.c~mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces fs/proc/meminfo.c --- a/fs/proc/meminfo.c~mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces +++ a/fs/proc/meminfo.c @@ -168,7 +168,7 @@ static int meminfo_proc_show(struct seq_ K(global_page_state(NR_WRITEBACK)), K(global_page_state(NR_ANON_PAGES)), K(global_page_state(NR_FILE_MAPPED)), - K(global_page_state(NR_SHMEM)), + K(i.sharedram), K(global_page_state(NR_SLAB_RECLAIMABLE) + global_page_state(NR_SLAB_UNRECLAIMABLE)), K(global_page_state(NR_SLAB_RECLAIMABLE)), diff -puN mm/page_alloc.c~mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces mm/page_alloc.c --- a/mm/page_alloc.c~mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces +++ a/mm/page_alloc.c @@ -3047,7 +3047,7 @@ static inline void show_node(struct zone void si_meminfo(struct sysinfo *val) { val->totalram = totalram_pages; - val->sharedram = 0; + val->sharedram = global_page_state(NR_SHMEM); val->freeram = global_page_state(NR_FREE_PAGES); val->bufferram = nr_blockdev_pages(); val->totalhigh = totalhigh_pages; @@ -3067,6 +3067,7 @@ void si_meminfo_node(struct sysinfo *val for (zone_type = 0; zone_type < MAX_NR_ZONES; zone_type++) managed_pages += pgdat->node_zones[zone_type].managed_pages; val->totalram = managed_pages; + val->sharedram = node_page_state(nid, NR_SHMEM); val->freeram = node_page_state(nid, NR_FREE_PAGES); #ifdef CONFIG_HIGHMEM val->totalhigh = pgdat->node_zones[ZONE_HIGHMEM].managed_pages; _ Patches currently in -mm which might be from aquini@xxxxxxxxxx are mm-export-nr_shmem-via-sysinfo2-si_meminfo-interfaces.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html