Sample Header Ad - 728x90

Accurately monitoring RAM and swap usage while running zswap compression

1 vote
0 answers
353 views
I'm running zswap on 6.2.0-39-generic (Ubuntu 22.04, HWE). My understanding is that zswap intercepts pages marked for swap, compresses them (if possible) and stores them in a compressed section of the physical RAM up to a certain, user-specific point. In my case, zswap is set to use a maximum of 25% of the RAM. However, if I stress my system (which has 256GB of RAM and a 256GB /swapfile): stress --vm-bytes 250G --vm-keep -m 1 When viewed through the activity monitor, or free -h etc., firstly my RAM fills and then my "swap" begins to fills - way more than would be necessary to store 250GB. free -h reports: total used free shared buff/cache available Mem: 251Gi 249Gi 1.9Gi 35Mi 523Mi 598Mi Swap: 255Gi 128Gi 127Gi However sudo grep -R . /sys/kernel/debug/zswap/ reports: sudo grep -R . /sys/kernel/debug/zswap/ /sys/kernel/debug/zswap/same_filled_pages:10982 /sys/kernel/debug/zswap/stored_pages:33556168 /sys/kernel/debug/zswap/pool_total_size:45804953600 /sys/kernel/debug/zswap/duplicate_entry:0 /sys/kernel/debug/zswap/written_back_pages:0 /sys/kernel/debug/zswap/reject_compress_poor:0 /sys/kernel/debug/zswap/reject_kmemcache_fail:0 /sys/kernel/debug/zswap/reject_alloc_fail:0 /sys/kernel/debug/zswap/reject_reclaim_fail:0 /sys/kernel/debug/zswap/pool_limit_hit:0 33556168*4096 = ~128GB - which matches swap usage reported by free -h. So, is the system reporting the uncompressed file size as 'swap' still despite it being compressed by zswap and still on the RAM? Basically, how can I get an intuitive and reportable sense of: 1. Total physical RAM used (uncompressed) 2. Total physical RAM used (compressed via zswap) 3. Total swap-on-disk used 4. Total swap-on-disk remaining/free to use Also posted here: https://www.reddit.com/r/kernel/comments/18iykle/accurately_monitoring_ram_and_swap_usage_while/
Asked by user3012926 (11 rep)
Dec 15, 2023, 01:33 PM