Re: [PATCH v2] docs: proc.rst: meminfo: briefly describe gaps in memory accounting

From: Michal Hocko
Date: Tue Apr 20 2021 - 10:05:20 EST


On Tue 20-04-21 15:57:08, Michal Hocko wrote:
[...]
> Usual memory consumption is usually something like LRU pages + Slab
> memory + kernel stack + vmalloc used + pcp.
>
> > But I know that KernelStack is allocated through vmalloc these days,
> > and I don't know whether VmallocUsed includes KernelStack or whether I
> > can sum them. Similarly, is Mlocked a subset of Unevictable?

Forgot to reply to these two. Yes they do. So if we want to be precise
then you have to check the stack allocation configuration. There are
just so many traps lurking here. Something you get used to over time
but this is certainly far far away from an ideal state. What else we can
expect from an ad hoc approach to providing data to userspace that was
historically applied to this and many other proc interfaces. We are
trying to be strict for some time but some mistakes are simply hard to
fix up (e.g. accounting shmem as a page cache to name some more).

--
Michal Hocko
SUSE Labs