Re: Debug: mm: meminfo reports 222GiB of AnonPages but sum of RSS in ps is barely 400MiB

From: David Hildenbrand
Date: Wed Jan 17 2024 - 09:19:02 EST


On 17.01.24 12:39, Karim Manaouil wrote:
Hi,

My system says that 231GiB is used out of 251GiB, but when I try to find the
processes using this memory in htop or ps, I find nothing. In fact, the sum
of RSS memory across all processes listed in ps (both user and kernel process)
is barely 400MiB.

Hi,

which kernel are you running? Which debug options are enabled in the config?


A look at Meminfo shows that 222GiB of memory is AnonPages.
With the help of `numastat -m`, it is inactive anonymous, more precisely.

I am really baffled and I have no idea who is using my memory?!!


If it would only be "used", I would have suspected PCP lists. But if the memory shows up as AnonPages in /proc/meminfo, that memory should actually still be mapped into some MM.

Here is what `free -h` is reporting.

karim@luna:~/mem_debug$ free -h
total used free shared buff/cache available
Mem: 251Gi 231Gi 1.1Gi 52Mi 21Gi 20Gi
Swap: 119Gi 75Gi 43Gi

And this is meminfo:

karim@luna:~/mem_debug$ grep AnonPages /proc/meminfo
AnonPages: 222998596 kB

IIRC, the last one to drop mm->mm_users will call exit_mmap(), which will unmap all pages (making AnonPages go down) and free the memory (making used memory go down).

Maybe we have something call mmget(mm) but never mmput(mm)? Are you running any OOT drivers or "special" hw?

--
Cheers,

David / dhildenb