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

Andrey Ryabinin aryabinin at virtuozzo.com
Tue Feb 9 04:54:04 PST 2016



On 12/04/2015 08:16 PM, Vasily Averin wrote:
> 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)

So this is the actual problem. Whenever we use that formula the used calculated as
	used = total - free - buffers - cached - slab
means that 
	used =  -buffers
And the patch do nothing about this. We still could get the this situation.

> 
> 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
> 

It's not work-around, it's a correct bugfix. Shmem pages are accounted as "Cached".
So just removing it would make "Cached" value incorrect again.

Probably we could solve this by reading 'cached' value from memcg stats (mem_cgroup_read_stat()).



> 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>
> 
> 


More information about the Devel mailing list