library: correct 'used' memory calculations, <meminfo>
The <meminfo> module attempted to duplicate the former sysinfo memory calculations wherein 'SReclaimable' was added to 'Cached' for the 'kb_main_cached' equivalent. But, this original approach was wrong for two reasons. 1. The addition occurred too late to impact the 'USED' calculation which could then cause an underflow in the top memory display if 'SReclaimable' was heavily used. 2. In changing the actual /proc/meminfo 'Cached' value it meant that users could not rely on that proc(5) man page when interpreting the MEMINFO_MEM_CACHED results. So this commit adds a new enumerator for the inclusive cached amount plus repositions the calculation so that a MEMINFO_MEM_USED result will exclude 'SReclaimable'. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@@ -37,6 +37,7 @@ enum meminfo_item {
|
||||
MEMINFO_MEM_BOUNCE, // ul_int
|
||||
MEMINFO_MEM_BUFFERS, // ul_int
|
||||
MEMINFO_MEM_CACHED, // ul_int
|
||||
MEMINFO_MEM_CACHED_ALL, // ul_int
|
||||
MEMINFO_MEM_COMMIT_LIMIT, // ul_int
|
||||
MEMINFO_MEM_COMMITTED_AS, // ul_int
|
||||
MEMINFO_MEM_HARD_CORRUPTED, // ul_int
|
||||
@@ -79,6 +80,7 @@ enum meminfo_item {
|
||||
MEMINFO_DELTA_BOUNCE, // s_int
|
||||
MEMINFO_DELTA_BUFFERS, // s_int
|
||||
MEMINFO_DELTA_CACHED, // s_int
|
||||
MEMINFO_DELTA_CACHED_ALL, // s_int
|
||||
MEMINFO_DELTA_COMMIT_LIMIT, // s_int
|
||||
MEMINFO_DELTA_COMMITTED_AS, // s_int
|
||||
MEMINFO_DELTA_HARD_CORRUPTED, // s_int
|
||||
|
Reference in New Issue
Block a user