Merge pull request #655 from Deepak8858/fix/issue-389-vmstat-cache-info

fix: vmstat cache column should include SReclaimable
This commit is contained in:
Bluemangoo
2026-03-27 10:00:05 +08:00
committed by GitHub
2 changed files with 8 additions and 1 deletions
+4
View File
@@ -204,6 +204,7 @@ pub struct Meminfo {
pub mem_available: bytesize::ByteSize,
pub buffers: bytesize::ByteSize,
pub cached: bytesize::ByteSize,
pub s_reclaimable: bytesize::ByteSize,
pub swap_cached: bytesize::ByteSize,
pub active: bytesize::ByteSize,
pub inactive: bytesize::ByteSize,
@@ -226,6 +227,8 @@ impl Meminfo {
bytesize::ByteSize::from_str(proc_map.get("MemAvailable").unwrap()).unwrap();
let buffers = bytesize::ByteSize::from_str(proc_map.get("Buffers").unwrap()).unwrap();
let cached = bytesize::ByteSize::from_str(proc_map.get("Cached").unwrap()).unwrap();
let s_reclaimable =
bytesize::ByteSize::from_str(proc_map.get("SReclaimable").unwrap()).unwrap();
let swap_cached =
bytesize::ByteSize::from_str(proc_map.get("SwapCached").unwrap()).unwrap();
let active = bytesize::ByteSize::from_str(proc_map.get("Active").unwrap()).unwrap();
@@ -238,6 +241,7 @@ impl Meminfo {
mem_available,
buffers,
cached,
s_reclaimable,
swap_cached,
active,
inactive,
+4 -1
View File
@@ -354,7 +354,10 @@ fn get_memory_info(
}
let buffer = with_unit(memory_info.buffers.as_u64(), matches);
let cache = with_unit(memory_info.cached.as_u64(), matches);
let cache = with_unit(
(memory_info.cached + memory_info.s_reclaimable).as_u64(),
matches,
);
vec![
(len, format!("{swap_used}")),