Fixed
Created: Sep 18, 2015
Updated: Sep 8, 2018
Resolved Date: Sep 18, 2015
Found In Version: 7.0.0.9
Fix Version: 7.0.0.10
Severity: Severe
Applicable for: Wind River Linux 7
Component/s: Userspace
Current version of procps package is extremely old and project is not maintained any more. This old version has a problem with calculation of used and free memory (see detailed description below) while procps-ng (fork of procps, https://gitlab.com/procps-ng/procps ) already fixed this problem. Log of repository shows that new package also fixed other problem that we have not faced yet.
It seems like it has existed in Yocto at least since 2014-12-11 with poky commit 40304fc6b913051ee4a32c68d2fe5f2d04272fd2.
According to Yocto bug #6952, many distributions seems to have performed the change already.
We would like you to add procps-ng package to WindRiver Linux 5. If not possible, we would at least want the problem described below fixed in procps.
Free/used memory calculation problem:
Calculation of memory usage and amount of free memory in procps package is incorrect. SReclaimable value from /proc/meminfo should be considered as free because when some application needs a lot of memory Kernel will free reclaimable structures in Slab allocator (see e.g. http://lxr.free-electrons.com/source/Documentation/filesystemsLIN7-4796/proc.txt?v=3.4#L781
The easiest way to make reclaimable Slab cache bigger is to run "find / -name name_that_does_not_present_in_the_file_system".
See example:
=== root@fsb1 FSB ~ # free
total used free shared buffers cached
Mem: 24602008 462864 24139144 0 1504 292400
-/+ buffers/cache: 168960 24433048
Swap: 0 0 0
=== root@fsb1 FSB ~ # cat /proc/meminfo
MemTotal: 24602008 kB
MemFree: 24139072 kB
Buffers: 1512 kB
Cached: 292400 kB
...
Active: 40648 kB
Inactive: 267412 kB
...
Active(file): 3792 kB
Inactive(file): 151196 kB
...
Dirty: 4 kB
...
Slab: 44372 kB
SReclaimable: 13876 kB
SUnreclaim: 30496 kB
...
Committed_AS: 411896 kB
...
Then I forced increasing of cache and reclaimable SLAB and collected again:
=== root@fsb1 FSB ~ # find / -name some_name_that_does_not_exists
=== root@fsb1 FSB ~ # free
total used free shared buffers cached
Mem: 24602008 543432 24058576 0 1692 306500
-/+ buffers/cache: 235240 24366768
Swap: 0 0 0
=== root@fsb1 FSB ~ # cat /proc/meminfo
MemTotal: 24602008 kB
MemFree: 24058684 kB
Buffers: 1708 kB
Cached: 306504 kB
...
Active: 45284 kB
Inactive: 277084 kB
...
Active(file): 8428 kB
Inactive(file): 160868 kB
...
Dirty: 24 kB
...
Slab: 110184 kB
SReclaimable: 77524 kB
SUnreclaim: 32660 kB
...
Committed_AS: 411944 kB
...
Line "-/+ buffers/cache" is not affected by changing of "Cached" in meminfo. Anyway free memory in free output decreased about 70MB. At the same time reclaimable Slab (SReclaimable) increased ~65MB; therefore I believe that the problem is only with SReclaimable.
Also sources of procps proves that value of SReclaimable is not used.
Proof that SReclaimable should be considered as free:
We performed the following experiment. Wait till SReclaimable will have essential value (~200 Megabytes) and then allocate (simple program sources is attached) a lot of memory: free memory shown by procps.free + ~100 Megabytes, kill memory consumer and check /proc/meminfo again. Amount of SReclaimable will be lesser then before starting experiment.