computing drop-able caches

From: Daniel Walker
Date: Thu Jan 28 2016 - 18:43:02 EST


Hi,

My colleague Khalid and I are working on a patch which will provide a /proc file to output the size of the drop-able page cache.
One way to implement this is to use the current drop_caches /proc routine, but instead of actually droping the caches just add
up the amount.

Here's a quote Khalid,

"Currently there is no way to figure out the droppable pagecache size
from the meminfo output. The MemFree size can shrink during normal
system operation, when some of the memory pages get cached and is
reflected in "Cached" field. Similarly for file operations some of
the buffer memory gets cached and it is reflected in "Buffers" field.
The kernel automatically reclaims all this cached & buffered memory,
when it is needed elsewhere on the system. The only way to manually
reclaim this memory is by writing 1 to /proc/sys/vm/drop_caches. "

So my impression is that the drop-able cache is spread over two fields in meminfo.

Alright, the question is does this info live someplace else that we don't know about? Or someplace in the kernel where it could be
added to meminfo trivially ?

The point of the whole exercise is to get a better idea of free memory for our employer. Does it make sense to do this for computing free memory?

Any comments welcome..

Daniel