From: Yosry Ahmed <yosryahmed@google.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Chengming Zhou <zhouchengming@bytedance.com>,
Nhat Pham <nphamcs@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 5/6] mm/zswap: only support zswap_exclusive_loads_enabled
Date: Fri, 2 Feb 2024 01:04:01 +0000 [thread overview]
Message-ID: <Zbw_gZIyEHquaxho@google.com> (raw)
In-Reply-To: <20240201181240.GE321148@cmpxchg.org>
On Thu, Feb 01, 2024 at 01:12:40PM -0500, Johannes Weiner wrote:
> On Thu, Feb 01, 2024 at 03:49:05PM +0000, Chengming Zhou wrote:
> > The !zswap_exclusive_loads_enabled mode will leave compressed copy in
> > the zswap tree and lru list after the folio swapin.
> >
> > There are some disadvantages in this mode:
> > 1. It's a waste of memory since there are two copies of data, one is
> > folio, the other one is compressed data in zswap. And it's unlikely
> > the compressed data is useful in the near future.
> >
> > 2. If that folio is dirtied, the compressed data must be not useful,
> > but we don't know and don't invalidate the trashy memory in zswap.
> >
> > 3. It's not reclaimable from zswap shrinker since zswap_writeback_entry()
> > will always return -EEXIST and terminate the shrinking process.
> >
> > On the other hand, the only downside of zswap_exclusive_loads_enabled
> > is a little more cpu usage/latency when compression, and the same if
> > the folio is removed from swapcache or dirtied.
> >
> > Not sure if we should accept the above disadvantages in the case of
> > !zswap_exclusive_loads_enabled, so send this out for disscusion.
> >
> > Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
>
> This is interesting.
>
> First, I will say that I never liked this config option, because it's
> nearly impossible for a user to answer this question. Much better to
> just pick a reasonable default.
>
> What should the default be?
>
> Caching "swapout work" is helpful when the system is thrashing. Then
> recently swapped in pages might get swapped out again very soon. It
> certainly makes sense with conventional swap, because keeping a clean
> copy on the disk saves IO work and doesn't cost any additional memory.
>
> But with zswap, it's different. It saves some compression work on a
> thrashing page. But the act of keeping compressed memory contributes
> to a higher rate of thrashing. And that can cause IO in other places
> like zswap writeback and file memory.
Agreed.
At Google, we have been using exclusive loads for a very long time in
production, so I have no objections to this. The user interface is also
relatively new, so I don't think it will have accumulated users.
>
> It would be useful to have an A/B test to confirm that not caching is
> better. Can you run your test with and without keeping the cache, and
> in addition to the timings also compare the deltas for pgscan_anon,
> pgscan_file, workingset_refault_anon, workingset_refault_file?
That would be interesting :)
next prev parent reply other threads:[~2024-02-02 1:04 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 15:49 [PATCH 0/6] mm/zswap: optimize zswap lru list Chengming Zhou
2024-02-01 15:49 ` [PATCH 1/6] mm/zswap: add more comments in shrink_memcg_cb() Chengming Zhou
2024-02-01 17:45 ` Johannes Weiner
2024-02-01 23:55 ` Yosry Ahmed
2024-02-02 22:25 ` Nhat Pham
2024-02-01 15:49 ` [PATCH 2/6] mm/zswap: invalidate zswap entry when swap entry free Chengming Zhou
2024-02-01 17:49 ` Johannes Weiner
2024-02-01 20:56 ` Nhat Pham
2024-02-02 0:11 ` Yosry Ahmed
2024-02-02 8:10 ` Chengming Zhou
2024-02-01 15:49 ` [PATCH 3/6] mm/zswap: stop lru list shrinking when encounter warm region Chengming Zhou
2024-02-01 17:51 ` Johannes Weiner
2024-02-01 18:10 ` Nhat Pham
2024-02-02 0:15 ` Yosry Ahmed
2024-02-02 8:12 ` Chengming Zhou
2024-02-01 15:49 ` [PATCH 4/6] mm/zswap: remove duplicate_entry debug value Chengming Zhou
2024-02-01 17:55 ` Johannes Weiner
2024-02-02 8:18 ` Chengming Zhou
2024-02-02 22:17 ` Yosry Ahmed
2024-02-02 22:28 ` Nhat Pham
2024-02-03 4:29 ` Chengming Zhou
2024-02-01 15:49 ` [PATCH 5/6] mm/zswap: only support zswap_exclusive_loads_enabled Chengming Zhou
2024-02-01 18:12 ` Johannes Weiner
2024-02-02 1:04 ` Yosry Ahmed [this message]
2024-02-02 12:57 ` Chengming Zhou
2024-02-02 16:26 ` Johannes Weiner
2024-02-03 4:33 ` Chengming Zhou
2024-02-02 22:15 ` Yosry Ahmed
2024-02-02 22:31 ` Nhat Pham
2024-02-01 15:49 ` [PATCH 6/6] mm/zswap: zswap entry doesn't need refcount anymore Chengming Zhou
2024-02-02 1:11 ` Yosry Ahmed
2024-02-02 13:00 ` Chengming Zhou
2024-02-02 16:28 ` Johannes Weiner
2024-02-02 22:33 ` Nhat Pham
2024-02-02 22:36 ` Yosry Ahmed
2024-02-02 22:44 ` Nhat Pham
2024-02-03 5:09 ` Chengming Zhou
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=Zbw_gZIyEHquaxho@google.com \
--to=yosryahmed@google.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=zhouchengming@bytedance.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