linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: linux-mm@kvack.org, Johannes Weiner <hannes@cmpxchg.org>,
	Nhat Pham <nphamcs@gmail.com>,
	Chengming Zhou <chengming.zhou@linux.dev>
Subject: Re: [BUG] ZSwap leaks memory upon being disabled
Date: Fri, 25 Oct 2024 09:41:39 +0300	[thread overview]
Message-ID: <28352fb75268060f2e78a32325f02e46737a16ea.camel@yandex.ru> (raw)
In-Reply-To: <CAJD7tkY1kw7brQ_pzRajECEhfUDLRrdJj7w2TBAVte1K==co6g@mail.gmail.com>

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@yandex.ru> 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.
> 


  reply	other threads:[~2024-10-25  6:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 13:02 Konstantin Kharlamov
2024-10-24 20:47 ` Yosry Ahmed
2024-10-25  6:41   ` Konstantin Kharlamov [this message]
2024-10-25  7:50     ` Yosry Ahmed
2024-10-26 11:33       ` Konstantin Kharlamov
2024-10-26 17:47         ` Yosry Ahmed
2024-10-27  0:29           ` Konstantin Kharlamov
2024-10-27  3:14             ` Nhat Pham
2024-10-27  6:46               ` Yosry Ahmed
2024-10-27 10:11                 ` Konstantin Kharlamov
2024-10-27 10:32                   ` Konstantin Kharlamov
2024-10-27 11:28                     ` Konstantin Kharlamov
2024-10-27 19:31                       ` Yosry Ahmed
2024-10-27 22:13                         ` phantom memory in a cgroup (was [BUG] ZSwap leaks memory upon being disabled) Konstantin Kharlamov
2024-10-30 14:41                           ` Konstantin Kharlamov
2024-10-30 19:44                             ` Yosry Ahmed
2024-10-31 21:59                               ` Konstantin Kharlamov
2024-10-31 22:04                                 ` Yosry Ahmed
2024-10-27 10:25               ` [BUG] ZSwap leaks memory upon being disabled Konstantin Kharlamov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28352fb75268060f2e78a32325f02e46737a16ea.camel@yandex.ru \
    --to=hi-angel@yandex.ru \
    --cc=chengming.zhou@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox