On Sat, 2024-10-26 at 20:14 -0700, Nhat Pham wrote: > On Sat, Oct 26, 2024 at 5:29 PM Konstantin Kharlamov > <Hi-Angel@xxxxxxxxx> wrote: > > > > That was a good idea! The > > `/sys/fs/cgroup/system.slice/memory.swap.current` seems to have the > > missing half of the SWAP memory. From my understanding of the > > `systemctl status` graph `sytem.slice` and `user.slice` groups do > > not > > intersect, and by adding up `system.slice/…` + `user.slice/…` I get > > around 8G. > > > > However, I'm still unclear what does this memory belong to. > > `system.slice/memory.swap.current` is 4.4G currently, that's a lot > > and > > I'm not seeing anything that could take so much memory. > > I assume you do not have any proactive memory reclaimer? :) No, just the kernel with `vm.swappiness = 100` and with ZSWAP (ZSWAP is on on Archlinux nowadays via CONFIG_ZSWAP_DEFAULT_ON). > I believe > the top utility can display swap usage by process. Have you tried > that? I just tried. Well, the data seems the same as what `smem` shows, except I can't add up the column numbers because top is interactive 😊 I noticed plasmashell was too bloated, so restarted it. Didn't solve the problem with some unknown memory taking gigabytes in SWAP though. > There are a couple of edge cases - for instance, if you disable zswap > writeback and zswap at the same time. We will allocate slots on > swapfile, and store it at the page table entry, but we cannot store > the page's content in zswap or the swapfile, so the page remains in > memory. You're occupying swap space, but are not really saving any > memory usage. I never disabled zswap writeback and as of writing the words zswap is on, so this certainly not it. > IIRC, there is also an edge case where a page is faulted back into > memory from swap, but the associated swap space cannot be immediately > released. This should be temporary though - memory reclaimer will > attempt to release these pages later on, or they can be released when > we scan the swapfile for slots during swap out. Replied in a separate email.