free: use SReclaimable in cached
The previous commit added all of slab into the cache value. The thing was is cached in this context is something you can get back and reclaim if under memory pressure. The problem was slab parameter includes both reclaimable and unreclaimable values which doesn't make sense in this context. This commit make cached only use the reclaimable component. References: http://www.freelists.org/post/procps/OmegaPhilxxxxxxxxxxxxx-Bug799716-free-considers-cached-to-include-SUnreclaim https://github.com/brndnmtthws/conky/issues/130 https://bugs.debian.org/799716 Commits:05d751c4f0
6cb75efef8
This commit is contained in:
parent
88489be542
commit
602b9a02ce
2
free.1
2
free.1
@ -32,7 +32,7 @@ kernels 2.6.32, displayed as zero if not available)
|
|||||||
Memory used by kernel buffers (Buffers in /proc/meminfo)
|
Memory used by kernel buffers (Buffers in /proc/meminfo)
|
||||||
.TP
|
.TP
|
||||||
\fBcache\fR
|
\fBcache\fR
|
||||||
Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)
|
Memory used by the page cache and slabs (Cached and SReclaimable in /proc/meminfo)
|
||||||
.TP
|
.TP
|
||||||
\fBbuff/cache\fR
|
\fBbuff/cache\fR
|
||||||
Sum of \fBbuffers\fR and \fBcache\fR
|
Sum of \fBbuffers\fR and \fBcache\fR
|
||||||
|
@ -49,6 +49,7 @@ struct meminfo_data {
|
|||||||
unsigned long total;
|
unsigned long total;
|
||||||
unsigned long used;
|
unsigned long used;
|
||||||
unsigned long slab;
|
unsigned long slab;
|
||||||
|
unsigned long slab_reclaimable;
|
||||||
unsigned long swap_free;
|
unsigned long swap_free;
|
||||||
unsigned long swap_total;
|
unsigned long swap_total;
|
||||||
unsigned long swap_used;
|
unsigned long swap_used;
|
||||||
@ -185,6 +186,8 @@ PROCPS_EXPORT int procps_meminfo_read (
|
|||||||
case 'S':
|
case 'S':
|
||||||
if (0 == strcmp(head, "Slab:"))
|
if (0 == strcmp(head, "Slab:"))
|
||||||
valptr = &(info->data.slab);
|
valptr = &(info->data.slab);
|
||||||
|
if (0 == strcmp(head, "SReclaimable:"))
|
||||||
|
valptr = &(info->data.slab_reclaimable);
|
||||||
else if (0 == strcmp(head, "SwapFree:"))
|
else if (0 == strcmp(head, "SwapFree:"))
|
||||||
valptr = &(info->data.swap_free);
|
valptr = &(info->data.swap_free);
|
||||||
else if (0 == strcmp(head, "SwapTotal:"))
|
else if (0 == strcmp(head, "SwapTotal:"))
|
||||||
@ -212,7 +215,7 @@ PROCPS_EXPORT int procps_meminfo_read (
|
|||||||
if (0 == info->data.available) {
|
if (0 == info->data.available) {
|
||||||
info->data.available = info->data.free;
|
info->data.available = info->data.free;
|
||||||
}
|
}
|
||||||
info->data.cached += info->data.slab;
|
info->data.cached += info->data.slab_reclaimable;
|
||||||
info->data.swap_used = info->data.swap_total - info->data.swap_free;
|
info->data.swap_used = info->data.swap_total - info->data.swap_free;
|
||||||
|
|
||||||
/* if 'available' is greater than 'total' or our calculation of mem_used
|
/* if 'available' is greater than 'total' or our calculation of mem_used
|
||||||
|
Loading…
Reference in New Issue
Block a user