[Devel] [patch rh7] free shows used=0 inside centos7 CT

Vasily Averin vvs at virtuozzo.com
Fri Dec 4 09:16:00 PST 2015


Customer reports that free or top command inside Centos7 CT shows 0 memory used

free from procps-ng-3.3.10-3.el7 uses /proc/meminfo output and calculates
used = total - free - buffers - cache - slab

However kernel in some cases calculates "Cached" value in meminfo output by using
the same formula:
cached = total - free - slab (where buffers = 0)

Alternative calculation of cached value does not work  this time becasue
additional UB_SHMPAGES.held argument added to work-around 
"negative cached" problem in previous version of free/procps-ng
see PSBM-29352 and http://kb.sp.parallels.com/en/123422

However free output was changed some time ago and this old issue is not actual now.
https://gitlab.com/procps-ng/procps/commit/2f96eef7f86a12b81badef1c91ec2d503ae4029d
library: reverting tmpfs subtraction from cached (18-FEB-2014)

Therefore we're going to revert patch for previous issue 
and believe that it resolves current problem too.

https://jira.sw.ru/browse/PSBM-42024
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>

-------------- next part --------------
diff --git a/kernel/bc/vm_pages.c b/kernel/bc/vm_pages.c
index 1fff5a2..256f36f 100644
--- a/kernel/bc/vm_pages.c
+++ b/kernel/bc/vm_pages.c
@@ -577,8 +577,7 @@ static int bc_fill_meminfo(struct user_beancounter *ub,
 	mi->cached = min(mi->si->totalram - mi->si->freeram -
 			mi->slab_reclaimable - mi->slab_unreclaimable,
 			mi->pages[LRU_INACTIVE_FILE] +
-			mi->pages[LRU_ACTIVE_FILE] +
-			ub->ub_parms[UB_SHMPAGES].held);
+			mi->pages[LRU_ACTIVE_FILE]);
 out:
 	return ret;
 }


More information about the Devel mailing list