Skip to content

Commit

Permalink
free: use SReclaimable in cached
Browse files Browse the repository at this point in the history
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
 brndnmtthws/conky#130
 https://bugs.debian.org/799716

Commits:
 6cb75ef
  • Loading branch information
csmall committed Oct 24, 2015
1 parent 9fda3da commit 05d751c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion free.1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ kernels 2.6.32, displayed as zero if not available)
Memory used by kernel buffers (Buffers in /proc/meminfo)
.TP
\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
\fBbuff/cache\fR
Sum of \fBbuffers\fR and \fBcache\fR
Expand Down
2 changes: 1 addition & 1 deletion proc/sysinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ void meminfo(void){
if(kb_inactive==~0UL){
kb_inactive = kb_inact_dirty + kb_inact_clean + kb_inact_laundry;
}
kb_main_cached = kb_page_cache + kb_slab;
kb_main_cached = kb_page_cache + kb_slab_reclaimable;
kb_swap_used = kb_swap_total - kb_swap_free;

/* if kb_main_available is greater than kb_main_total or our calculation of
Expand Down

0 comments on commit 05d751c

Please sign in to comment.