[PATCH v2] top: fix and merge code to parse /proc/meminfo

Denys Vlasenko vda.linux at googlemail.com
Sun Jul 27 19:50:28 UTC 2014

On Mon, Jul 21, 2014 at 1:14 PM, Timo Teräs <timo.teras at iki.fi> wrote:
> display_header() code to parse meminfo as is was buggy:
> - uninitialized variables were used if meminfo was not as expected
> - meminfo parsing failed on new kernels (3.14+) as new field 'MemAvailable'
>   was introduced between MemFree and Buffers
> - shared memory was handled only for ancient kernels (2.4.x and earlier)
> as result Buffers and shared memory fields were shown with bogus values
> on current kernels.
> The new code does not try to parse the old style summary header, as the
> separated fields are always present (it saves code size). Additionally,
> both Shmem (2.6+) and MemShared (2.4 and earlier) fields are now parsed
> and summed for shared memory usage; as only one of them exists depending
> on kernel version.
> display_topmem_header() parses also meminfo so this makes it use the
> same code for code shrink.

Applied, thanks!

More information about the busybox mailing list