Re: Column used in free

"Dr. Werner Fink" <[email protected]> Fri, 9 Dec 2022 15:10:31 +0100
Newsgroups gmane.linux.procps.devel
Message-ID <[email protected]>
--ygQbOxzjUdjXwCCq
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2022/12/09 13:36:58 +0000, Samuel Fusato wrote:
> Dear all,
>=20
> I am wondering if I can get some ELI5 explanation about the used column o=
f free. I am on a SLES15-SP3 using the latest kernel. Here is the procps ve=
rsion installed:
>=20
> sles15-sp3:~ # rpm -qa | grep procps
> libprocps7-3.3.15-150000.7.25.1.x86_64

This might be fixed with the latest procps

 - Add the patches
   * procps-3.3.17-library-bsc1181475.patch
   * procps-3.3.17-top-bsc1181475.patch
   which are backports of current newlib tree to solve bug bsc#1181475
   * 'free' command reports misleading "used" value

Compare with https://bugzilla.opensuse.org/show_bug.cgi?id=3D1181475
Bug=C2=A01181475 -- 'free' command reports misleading "used" value

> procps-3.3.15-150000.7.25.1.x86_64
>=20
> I am unable to calculate the `used` column based on the man page descript=
ion:
>=20
> > used   Used memory (calculated as total - free - buffers - cache)
>=20
> Here is the output of "/proc/meminfo"=E2=80=8B + "free -k=E2=80=8B":
>=20
> 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   ava=
ilable
> Mem:         990456      557644       84412       18324      514528      =
432812
> Swap:       1334248         268     1333980
> sles15-sp3:~ #
>=20
> How can one calculate the Used column?
>=20
> calculated as total - free - buffers - cache
>=20
> 2324704 - 1418652 - 884 - 513644 =3D 391524
> or
> 2324704 + 1418652 + 884 + 513644 =3D 4257884
>=20
> Cache
> ---
> Memory  used  by  the  page  cache  and  slabs  (Cached  and  SReclaimabl=
e in /proc/meminfo)
> =E2=80=82=E2=80=82=E2=80=82=E2=80=82=E2=80=82=E2=80=82Cached + SReclaimab=
le =3D 477372 + 36272 =3D 513644
>=20
> Can you someone please let me know? Is it possible to do this?

This does not belong to this mailing list.


--=20
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

--ygQbOxzjUdjXwCCq
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJgBAABCABKFiEEGwa/WjgpkPvLonW+UOkNVR3Bay4FAmOTQdMsFIAAAAAAFQAO
cGthLWFkZHJlc3NAZ251cGcub3Jnd2VybmVyQHN1c2UuZGUACgkQUOkNVR3Bay7E
Lw/9FmauN8e9iPZWc1QPiyirhgWjntFt/Z4Bc82kVWDTZj4xwmuiqAiKrtTIWDUM
gvZeh2TSAEfY1W6pTNqy4Guf4jYRZnGHujV8Vfe3AZWd71r8pn6UthkpAX14dzax
/Sx+/4UvbeV1QkbbpDFQTFIcN2tWh5yQmBpGFdUcoweF57MVd0jPOCm20Sr5sQ2F
yzE+Jj6afQQUgd/yN1igXjpxzDZzLpIZFjohwT368DkCZqpKTKBnwJ8e8NXuZjFF
6Up2ovVc9AVIHvcgnqb50f1+9mLoungcHa1v+STEHsLior/AUYtQNQPFizOqtXJP
i4fB2ghh+OmpRCVKEUoUTGH2olsaI1CJoY1kBQkBzgI7Ae86UkYv3jcR98N04yfS
IZaUDsgVDs55Xc2yTOuZR+MdMww2Fb8kdVen0RyTXiaiw6tEM79R7xy8GdRbd3ry
iOppsTEHdJqT5tXif+qCs3wmsly+hQ8isyhBi27z1XvgGTx1QHcxQJppaebQMPnc
VbGn0cMVtHFuiw2iWay97TeCE53G3RxD17yITu8/PTIYwoC64TUZWVuqwVW24sLG
IIElZq5fPKBX9+GK7onFxleugu7f7Y2OSb1numwRnBv5B+fHpyt6wMhbhIoXxRKF
svnofT2E+dLxlPuAUWPaWkL4uJKCs49pGaWhcfgAldauVto=
=mI4X
-----END PGP SIGNATURE-----

--ygQbOxzjUdjXwCCq--