From 0f2c9edec4b003fd06b14cde489f974df18609cb Mon Sep 17 00:00:00 2001 From: Deepak Singh Date: Fri, 20 Mar 2026 09:31:08 +0000 Subject: [PATCH] fix: vmstat cache column should include SReclaimable (closes #389) --- src/uu/vmstat/src/parser.rs | 4 ++++ src/uu/vmstat/src/picker.rs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/uu/vmstat/src/parser.rs b/src/uu/vmstat/src/parser.rs index 85441205..63fdcf2d 100644 --- a/src/uu/vmstat/src/parser.rs +++ b/src/uu/vmstat/src/parser.rs @@ -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, diff --git a/src/uu/vmstat/src/picker.rs b/src/uu/vmstat/src/picker.rs index 036c2e41..ec6a80f0 100644 --- a/src/uu/vmstat/src/picker.rs +++ b/src/uu/vmstat/src/picker.rs @@ -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}")),