aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2017-08-10 18:23:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-08-10 18:54:06 -0400
commitd507e2ebd2c7be9138e5cf5c0cb1931c90c42ab1 (patch)
tree3ee794865430f69ddfba9d87a876bf3f497ad249 /fs
parent26273939ace935dd7553b31d279eab30b40f7b9a (diff)
mm: fix global NR_SLAB_.*CLAIMABLE counter reads
As Tetsuo points out: "Commit 385386cff4c6 ("mm: vmstat: move slab statistics from zone to node counters") broke "Slab:" field of /proc/meminfo . It shows nearly 0kB" In addition to /proc/meminfo, this problem also affects the slab counters OOM/allocation failure info dumps, can cause early -ENOMEM from overcommit protection, and miscalculate image size requirements during suspend-to-disk. This is because the patch in question switched the slab counters from the zone level to the node level, but forgot to update the global accessor functions to read the aggregate node data instead of the aggregate zone data. Use global_node_page_state() to access the global slab counters. Fixes: 385386cff4c6 ("mm: vmstat: move slab statistics from zone to node counters") Link: http://lkml.kernel.org/r/20170801134256.5400-1-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Josef Bacik <josef@toxicpanda.com> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: Stefan Agner <stefan@agner.ch> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/meminfo.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 8a428498d6b2..509a61668d90 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -106,13 +106,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
106 global_node_page_state(NR_FILE_MAPPED)); 106 global_node_page_state(NR_FILE_MAPPED));
107 show_val_kb(m, "Shmem: ", i.sharedram); 107 show_val_kb(m, "Shmem: ", i.sharedram);
108 show_val_kb(m, "Slab: ", 108 show_val_kb(m, "Slab: ",
109 global_page_state(NR_SLAB_RECLAIMABLE) + 109 global_node_page_state(NR_SLAB_RECLAIMABLE) +
110 global_page_state(NR_SLAB_UNRECLAIMABLE)); 110 global_node_page_state(NR_SLAB_UNRECLAIMABLE));
111 111
112 show_val_kb(m, "SReclaimable: ", 112 show_val_kb(m, "SReclaimable: ",
113 global_page_state(NR_SLAB_RECLAIMABLE)); 113 global_node_page_state(NR_SLAB_RECLAIMABLE));
114 show_val_kb(m, "SUnreclaim: ", 114 show_val_kb(m, "SUnreclaim: ",
115 global_page_state(NR_SLAB_UNRECLAIMABLE)); 115 global_node_page_state(NR_SLAB_UNRECLAIMABLE));
116 seq_printf(m, "KernelStack: %8lu kB\n", 116 seq_printf(m, "KernelStack: %8lu kB\n",
117 global_page_state(NR_KERNEL_STACK_KB)); 117 global_page_state(NR_KERNEL_STACK_KB));
118 show_val_kb(m, "PageTables: ", 118 show_val_kb(m, "PageTables: ",