Currently it's not possible to monitor regular swap (as partition of file) usage if system uses zram. The sensor shows overall swap usage as it would be shown in 'free -h', which shows zram and swap combined. It would be nice if there was separate sensors for regular swap and zram as shown by 'swapon --show'.
We currently read the memory info from `/proc/meminfo`. Can you share the contents of both that file and `/proc/swaps`?
(In reply to Arjen Hiemstra from comment #1) > We currently read the memory info from `/proc/meminfo`. Can you share the > contents of both that file and `/proc/swaps`? This the reading I get when zram is occupied and swap isn't. But Plasma System Monitor reports 3.5% swap usage. cat /proc/meminfo: MemTotal: 15705168 kB MemFree: 352044 kB MemAvailable: 5111816 kB Buffers: 40352 kB Cached: 5643584 kB SwapCached: 0 kB Active: 6109352 kB Inactive: 7432168 kB Active(anon): 5955404 kB Inactive(anon): 2759824 kB Active(file): 153948 kB Inactive(file): 4672344 kB Unevictable: 1168 kB Mlocked: 1168 kB SwapTotal: 28332536 kB SwapFree: 27519992 kB Zswap: 0 kB Zswapped: 0 kB Dirty: 268 kB Writeback: 0 kB AnonPages: 7853856 kB Mapped: 1197188 kB Shmem: 857572 kB KReclaimable: 268056 kB Slab: 440336 kB SReclaimable: 268056 kB SUnreclaim: 172280 kB KernelStack: 23632 kB PageTables: 52664 kB SecPageTables: 4264 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 36185120 kB Committed_AS: 18985576 kB VmallocTotal: 34359738367 kB VmallocUsed: 140564 kB VmallocChunk: 0 kB Percpu: 10368 kB HardwareCorrupted: 0 kB AnonHugePages: 3624960 kB ShmemHugePages: 0 kB ShmemPmdMapped: 0 kB FileHugePages: 190464 kB FilePmdMapped: 167936 kB CmaTotal: 0 kB CmaFree: 0 kB Unaccepted: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB Hugetlb: 0 kB DirectMap4k: 940676 kB DirectMap2M: 13060096 kB DirectMap1G: 3145728 kB cat /proc/swaps: Filename Type Size Used Priority /dev/zram0 partition 7852540 972288 100 /media/dysk/swapfile file 20479996 0 -2
This bug is still present. ~ $ swapon --show NAME TYPE SIZE USED PRIO /swapfile file 8G 416.7M -2 /dev/zram0 partition 1.4G 1.2G 16383
Why is this a problem, though? Can you describe what problem it's causing you and how it would be better for each source of swap to be shown separately?
(In reply to Nate Graham from comment #4) > Why is this a problem, though? Can you describe what problem it's causing > you and how it would be better for each source of swap to be shown > separately? It's not much of a problem. It would just be nice to be able to monitor those two swaps separately as they are not the same thing.
Fair enough!
The limitation seems to be that ksystemstats currently relies on /proc/meminfo, which only exposes combined swap usage, while /proc/swaps already provides per-device usage (including zram vs file/partition). One possible approach would be to keep the existing swap sensors unchanged and add additional sensors derived from /proc/swaps, allowing zram-backed and disk-backed swap to be monitored separately. If that sounds reasonable, Iād be happy to work on an implementation.