Re: free: regression due to a different calculation of Used memory

Craig Small <[email protected]> Thu, 29 Apr 2021 22:08:31 +1000
Newsgroups gmane.linux.procps.devel
Message-ID <CALy8Cw5BtE-K2dNLCOM_BNjZeUjsx63wXwjnazD9-JSY4Rzhkg@mail.gmail.com>
On Tue, 6 Apr 2021 at 16:57, Michal Hocko <[email protected]>
wrote:

> Slab part was merely something I've spotted in the referenced commit and
> not something that is causing the main problem. That is indeed ths
> swap backed page cache. More on that below.
>
> If there is no clear semantic behind the value then it likely shouldn't
> try to be clever. I do understand that many people are confused by their
> system consuming a lot of memory for caching. This is not something new
> and I am afraid that hiding that fact from them is just going to
> continue confusion elsewhere. As you can see by this bug report.
>
It's (what is used memory) been a problem since  I started using Linux and
that version started with 0, I can remember back then "Linux uses much more
memory".
Doesn't help here, but as you say its a long-standing problem.

> Cache includes tmpfs which is file backed not memory
>
> No, this is not quite right. tmpfs/shmem is a general concept for
> shared memory with swap as a backing storage. That can be MAP_SHARED |
> MAP_ANON
> mapping, tmpfs mounted filesystem, memfd, System V shm  and many others.
>

proc(5) says Cached (as in the line /proc/meminfo ) is only based on disk,
or in its words
  "In-memory cache for files read from the disk (the page cache).  Doesn't
include SwapCached."

Is the man page incorrect?

I think that's the main difference now.  Ideally this could be settled by
the kernel exposing MemUsed in /proc/meminfo and everyone can use that
(it's how available was solved).

 - Craig