mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
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. Change-Id: I51474973cc267ee368352e96e7229e0101f38aca Signed-off-by: Rafael Aquini <aquini@redhat.com> Acked-by: Rik 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
37e62218c3
commit
29af476bb5
3 changed files with 4 additions and 2 deletions
|
@ -132,6 +132,7 @@ static ssize_t node_read_meminfo(struct device *dev,
|
|||
nid, K(node_page_state(nid, NR_ANON_PAGES)),
|
||||
#endif
|
||||
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)),
|
||||
|
|
|
@ -142,7 +142,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
|
|||
K(global_page_state(NR_ANON_PAGES)),
|
||||
#endif
|
||||
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)),
|
||||
|
|
|
@ -2837,7 +2837,7 @@ EXPORT_SYMBOL_GPL(si_mem_available);
|
|||
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;
|
||||
|
@ -2853,6 +2853,7 @@ void si_meminfo_node(struct sysinfo *val, int nid)
|
|||
pg_data_t *pgdat = NODE_DATA(nid);
|
||||
|
||||
val->totalram = pgdat->node_present_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].present_pages;
|
||||
|
|
Loading…
Reference in a new issue