On Thu, 2024-10-24 at 13:47 -0700, Yosry Ahmed wrote: > On Thu, Oct 24, 2024 at 6:02 AM Konstantin Kharlamov > <Hi-Angel@xxxxxxxxx> wrote: > > > > When ZSWAP is disabled, the `Zswap` and `Zswapped` in meminfo are > > still non-zero. > > IOW, ZSWAP doesn't free memory upon being disabled. > > > > Stumbled upon this while trying to figure out where did ≈4G of my > > SWAP memory > > disappear. Been seeing some unknown memory in SWAP for years, now I > > suspect ZSWAP > > might be the culprit. But no way to know for sure because of this > > bug. > > > > # Steps to reproduce > > > > 1. Enable ZSWAP > > 2. Wait for `grep Zswap /proc/meminfo` to become non-zero > > 3. Disable ZSWAP via `sudo sh -c "echo 0 > > > /sys/module/zswap/parameters/enabled"` > > 4. Look at `grep Zswap /proc/meminfo` > > > > ## Expected > > > > The rows are zero because ZSWAP is disabled. > > Not really, the expected behavior is that further swapouts will not > go > to zswap, but pages that are already compressed in zswap will not be > written out to the backing swapfile or swapped back to memory. A > swapoff would be required for the latter. > > This is documented in: > https://docs.kernel.org/admin-guide/mm/zswap.html#overview. Oh, I see, thank you, sorry for the noise. Then, I'm curious, is it correct to assume that this `Zswap`-prefixed memory mentioned in meminfo is never the one that is in SWAP? I mean, Zswap being a buffer before data goes to swap kind of implies that yes, the data *either* in zswap or in swap. But just wanted to hear that explicitly. The background to my question is that I'm trying to find the culprit some "phantom memory" eventually filling up my SWAP. This memory is not one accounted to apps (as calculated via `smem`), nor to tmpfs. So my next suspect was something related to ZSwap. >