[procps] Re: [OmegaPhil@xxxxxxxxxxxxx: Bug#799716: free considers 'cached' to include SUnreclaim]

  • From: OmegaPhil <OmegaPhil@xxxxxxxxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Sun, 11 Oct 2015 18:19:24 +0100

On 23/09/15 14:18, Craig Small wrote:

On Tue, Sep 22, 2015 at 12:05:04PM -0500, Jim Warner wrote:
That someone is Jaromir, unless you want to assume ownership.

I don't know the memory management well enough to state which way is
correct. Re-reading the previous threads it didn't seem you were sure
either.

The whole thing comes down what is used memory?
Take total memory and subtract the free memory, that's an easy start.
We also remove buffers and cache and slab (though its not in the man
page).

The last is the problem, slab has reclaimable and non-reclaimable parts.
We remove both for the used memory, but I can see non-reclaimable is
*really* being used so should stay (and we only remove reclaimable).

However there is now available. So should there be a difference between
the two? Why are some things excluded from free and not available?

I have 1.8G used, 1.2G free and 13.8G available.
So 1.2G isn't used at all, but about 12.6G is used but could be
returned?

- Craig


Since this has apparently gone nowhere, I've had a look into this -
'Available' is a new stat added in January 2014 which aims to give the
users a figure of memory available that, once used, will cause kswapd to
start swapping pages out - here is the commit adding it:

https://github.com/torvalds/linux/commit/34e431b0ae398fc54ea69ff85ec700722c9da773

The commit comment and comments in the patch are good enough to
illuminate what Available is (see also '2.2.1 Zone Watermarks[0] for
understanding the important wmark_low).

I'm guessing the free tool is mainly interested in reporting the
remaining free memory, regardless of precisely what magic value causes
swapping to occur - i.e. the point at which you are genuinely out of memory.

Separate to this, the available calculation
(fs/proc/meminfo.c:meminfo_proc_show) only takes into account
NR_SLAB_RECLAIMABLE and therefore ignores NR_SLAB_UNRECLAIMABLE - this
backs up what I said earlier that free is wrong to consider SUnreclaim
as part of the cache.


0: https://www.kernel.org/doc/gorman/html/understand/understand005.html

Attachment: signature.asc
Description: OpenPGP digital signature

Other related posts: