aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2018-10-26 18:05:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-26 19:26:32 -0400
commit61f94e18de94f79abaad3bb83549ff78923ac785 (patch)
treee76af5163ffc10843bf5d6c5e07a2078b2dd4b30 /drivers/base
parentb29940c1abd7a4c3abeb926df0a5ec84d6902d47 (diff)
mm, proc: add KReclaimable to /proc/meminfo
The vmstat NR_KERNEL_MISC_RECLAIMABLE counter is for kernel non-slab allocations that can be reclaimed via shrinker. In /proc/meminfo, we can show the sum of all reclaimable kernel allocations (including slab) as "KReclaimable". Add the same counter also to per-node meminfo under /sys With this counter, users will have more complete information about kernel memory usage. Non-slab reclaimable pages (currently just the ION allocator) will not be missing from /proc/meminfo, making users wonder where part of their memory went. More precisely, they already appear in MemAvailable, but without the new counter, it's not obvious why the value in MemAvailable doesn't fully correspond with the sum of other counters participating in it. Link: http://lkml.kernel.org/r/20180731090649.16028-6-vbabka@suse.cz Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Roman Gushchin <guro@fb.com> Cc: Christoph Lameter <cl@linux.com> Cc: David Rientjes <rientjes@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Laura Abbott <labbott@redhat.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Michal Hocko <mhocko@kernel.org> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Vijayanand Jitta <vjitta@codeaurora.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/node.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 1ac4c36e13bb..86d6cd92ce3d 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -67,8 +67,11 @@ static ssize_t node_read_meminfo(struct device *dev,
67 int nid = dev->id; 67 int nid = dev->id;
68 struct pglist_data *pgdat = NODE_DATA(nid); 68 struct pglist_data *pgdat = NODE_DATA(nid);
69 struct sysinfo i; 69 struct sysinfo i;
70 unsigned long sreclaimable, sunreclaimable;
70 71
71 si_meminfo_node(&i, nid); 72 si_meminfo_node(&i, nid);
73 sreclaimable = node_page_state(pgdat, NR_SLAB_RECLAIMABLE);
74 sunreclaimable = node_page_state(pgdat, NR_SLAB_UNRECLAIMABLE);
72 n = sprintf(buf, 75 n = sprintf(buf,
73 "Node %d MemTotal: %8lu kB\n" 76 "Node %d MemTotal: %8lu kB\n"
74 "Node %d MemFree: %8lu kB\n" 77 "Node %d MemFree: %8lu kB\n"
@@ -118,6 +121,7 @@ static ssize_t node_read_meminfo(struct device *dev,
118 "Node %d NFS_Unstable: %8lu kB\n" 121 "Node %d NFS_Unstable: %8lu kB\n"
119 "Node %d Bounce: %8lu kB\n" 122 "Node %d Bounce: %8lu kB\n"
120 "Node %d WritebackTmp: %8lu kB\n" 123 "Node %d WritebackTmp: %8lu kB\n"
124 "Node %d KReclaimable: %8lu kB\n"
121 "Node %d Slab: %8lu kB\n" 125 "Node %d Slab: %8lu kB\n"
122 "Node %d SReclaimable: %8lu kB\n" 126 "Node %d SReclaimable: %8lu kB\n"
123 "Node %d SUnreclaim: %8lu kB\n" 127 "Node %d SUnreclaim: %8lu kB\n"
@@ -138,20 +142,21 @@ static ssize_t node_read_meminfo(struct device *dev,
138 nid, K(node_page_state(pgdat, NR_UNSTABLE_NFS)), 142 nid, K(node_page_state(pgdat, NR_UNSTABLE_NFS)),
139 nid, K(sum_zone_node_page_state(nid, NR_BOUNCE)), 143 nid, K(sum_zone_node_page_state(nid, NR_BOUNCE)),
140 nid, K(node_page_state(pgdat, NR_WRITEBACK_TEMP)), 144 nid, K(node_page_state(pgdat, NR_WRITEBACK_TEMP)),
141 nid, K(node_page_state(pgdat, NR_SLAB_RECLAIMABLE) + 145 nid, K(sreclaimable +
142 node_page_state(pgdat, NR_SLAB_UNRECLAIMABLE)), 146 node_page_state(pgdat, NR_KERNEL_MISC_RECLAIMABLE)),
143 nid, K(node_page_state(pgdat, NR_SLAB_RECLAIMABLE)), 147 nid, K(sreclaimable + sunreclaimable),
148 nid, K(sreclaimable),
149 nid, K(sunreclaimable)
144#ifdef CONFIG_TRANSPARENT_HUGEPAGE 150#ifdef CONFIG_TRANSPARENT_HUGEPAGE
145 nid, K(node_page_state(pgdat, NR_SLAB_UNRECLAIMABLE)), 151 ,
146 nid, K(node_page_state(pgdat, NR_ANON_THPS) * 152 nid, K(node_page_state(pgdat, NR_ANON_THPS) *
147 HPAGE_PMD_NR), 153 HPAGE_PMD_NR),
148 nid, K(node_page_state(pgdat, NR_SHMEM_THPS) * 154 nid, K(node_page_state(pgdat, NR_SHMEM_THPS) *
149 HPAGE_PMD_NR), 155 HPAGE_PMD_NR),
150 nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) * 156 nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) *
151 HPAGE_PMD_NR)); 157 HPAGE_PMD_NR)
152#else
153 nid, K(node_page_state(pgdat, NR_SLAB_UNRECLAIMABLE)));
154#endif 158#endif
159 );
155 n += hugetlb_report_node_meminfo(nid, buf + n); 160 n += hugetlb_report_node_meminfo(nid, buf + n);
156 return n; 161 return n;
157} 162}