Re: [bug, 4.8] /proc/meminfo: counter values are very wrong
From: Mel Gorman
Date: Thu Aug 04 2016 - 08:36:15 EST
On Thu, Aug 04, 2016 at 01:24:09PM +0100, Mel Gorman wrote:
> On Thu, Aug 04, 2016 at 03:10:51PM +1000, Dave Chinner wrote:
> > Hi folks,
> >
> > I just noticed a whacky memory usage profile when running some basic
> > IO tests on a current 4.8 tree. It looked like there was a massive
> > memory leak from my monitoring graphs - doing buffered IO was
> > causing huge amounts of memory to be considered used, but the cache
> > size was not increasing.
> >
> > Looking at /proc/meminfo:
> >
> > $ cat /proc/meminfo
> > MemTotal: 16395408 kB
> > MemFree: 79424 kB
> > MemAvailable: 2497240 kB
> > Buffers: 4372 kB
> > Cached: 558744 kB
> > SwapCached: 48 kB
> > Active: 2127212 kB
> > Inactive: 100400 kB
> > Active(anon): 25348 kB
> > Inactive(anon): 79424 kB
> > Active(file): 2101864 kB
> > Inactive(file): 20976 kB
> > Unevictable: 13612980 kB <<<<<<<<<
>
> This? Very quickly done, no boot testing
>
Or better yet, this. This is aimed at the proc reporting only.
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 09e18fdf61e5..b9a8c813e5e6 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -46,7 +46,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
cached = 0;
for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++)
- pages[lru] = global_page_state(NR_LRU_BASE + lru);
+ pages[lru] = global_node_page_state(NR_LRU_BASE + lru);
available = si_mem_available();
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fb975cec3518..baa97da3687d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4064,7 +4064,7 @@ long si_mem_available(void)
int lru;
for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++)
- pages[lru] = global_page_state(NR_LRU_BASE + lru);
+ pages[lru] = global_node_page_state(NR_LRU_BASE + lru);
for_each_zone(zone)
wmark_low += zone->watermark[WMARK_LOW];
--
Mel Gorman
SUSE Labs