Column used in free
"Samuel Fusato" <[email protected]> ("samuel.fusato") Fri, 9 Dec 2022 13:36:58 +0000
| Newsgroups | gmane.linux.procps.devel |
|---|---|
| Message-ID | <DBAPR04MB7447C6EAE5B2A398D285F085921C9@DBAPR04MB7447.eurprd04.prod.outlook.com> |
Dear all,
I am wondering if I can get some ELI5 explanation about the used column of free. I am on a SLES15-SP3 using the latest kernel. Here is the procps version installed:
sles15-sp3:~ # rpm -qa | grep procps
libprocps7-3.3.15-150000.7.25.1.x86_64
procps-3.3.15-150000.7.25.1.x86_64
I am unable to calculate the `used` column based on the man page description:
> used Used memory (calculated as total - free - buffers - cache)
Here is the output of "/proc/meminfo" + "free -k":
sles15-sp3:~ # cat /proc/meminfo ; free -k
MemTotal: 990456 kB
MemFree: 84672 kB
MemAvailable: 433072 kB
Buffers: 884 kB
Cached: 477372 kB
SwapCached: 236 kB
Active: 485656 kB
Inactive: 281300 kB
Active(anon): 240808 kB
Inactive(anon): 66248 kB
Active(file): 244848 kB
Inactive(file): 215052 kB
Unevictable: 8096 kB
Mlocked: 80 kB
SwapTotal: 1334248 kB
SwapFree: 1333980 kB
Dirty: 36 kB
Writeback: 0 kB
AnonPages: 290560 kB
Mapped: 159496 kB
Shmem: 18324 kB
KReclaimable: 36272 kB
Slab: 82568 kB
SReclaimable: 36272 kB
SUnreclaim: 46296 kB
KernelStack: 4236 kB
PageTables: 15096 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 1829476 kB
Committed_AS: 1503492 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 19020 kB
VmallocChunk: 0 kB
Percpu: 296 kB
HardwareCorrupted: 0 kB
AnonHugePages: 141312 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 126832 kB
DirectMap2M: 921600 kB
DirectMap1G: 0 kB
total used free shared buff/cache available
Mem: 990456 557644 84412 18324 514528 432812
Swap: 1334248 268 1333980
sles15-sp3:~ #
How can one calculate the Used column?
calculated as total - free - buffers - cache
2324704 - 1418652 - 884 - 513644 = 391524
or
2324704 + 1418652 + 884 + 513644 = 4257884
Cache
---
Memory used by the page cache and slabs (Cached and SReclaimable in /proc/meminfo)
Cached + SReclaimable = 477372 + 36272 = 513644
Can you someone please let me know? Is it possible to do this?
Thank you,
Samuel