diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-07-21 14:14:24 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-07-27 21:49:27 +0200 |
commit | 7df1f1dda1f997c44800d16a9a12cf6cae2ed7e7 (patch) | |
tree | 6e5f6e27360e50a574c4e03c624ab0b07576f57c /scripts/Makefile.build | |
parent | 2a563ea49a16589f47ed6afe7b22eebef4e3a6d1 (diff) | |
download | busybox-7df1f1dda1f997c44800d16a9a12cf6cae2ed7e7.tar.gz |
top: fix and merge code to parse /proc/meminfo
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.
function old new delta
display_header - 681 +681
display_topmem_process_list 465 684 +219
parse_meminfo - 189 +189
static.fields - 106 +106
static.match 132 - -132
.rodata 120254 120117 -137
display_topmem_header 513 - -513
display_process_list 1705 667 -1038
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 1/2 up/down: 1195/-1820) Total: -625 bytes
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'scripts/Makefile.build')
0 files changed, 0 insertions, 0 deletions