From: Andrew Morton <akpm@linux-foundation.org>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Seth Jennings <sjenning@redhat.com>,
Dan Streetman <ddstreet@ieee.org>,
Vitaly Wool <vitaly.wool@konsulko.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Nhat Pham <nphamcs@gmail.com>,
Domenico Cerasuolo <cerasuolodomenico@gmail.com>,
Yu Zhao <yuzhao@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: zswap: support exclusive loads
Date: Tue, 30 May 2023 14:15:47 -0700 [thread overview]
Message-ID: <20230530141547.609c4a434470c3fbf7570ff8@linux-foundation.org> (raw)
In-Reply-To: <20230530210251.493194-1-yosryahmed@google.com>
On Tue, 30 May 2023 21:02:51 +0000 Yosry Ahmed <yosryahmed@google.com> wrote:
> Commit 71024cb4a0bf ("frontswap: remove frontswap_tmem_exclusive_gets")
> removed support for exclusive loads from frontswap as it was not used.
>
> Bring back exclusive loads support to frontswap by adding an
> exclusive_loads argument to frontswap_ops. Add support for exclusive
> loads to zswap behind CONFIG_ZSWAP_EXCLUSIVE_LOADS.
Why is this Kconfigurable? Why not just enable the feature for all
builds?
> Refactor zswap entry invalidation in zswap_frontswap_invalidate_page()
> into zswap_invalidate_entry() to reuse it in zswap_frontswap_load().
>
> With exclusive loads, we avoid having two copies of the same page in
> memory (compressed & uncompressed) after faulting it in from zswap. On
> the other hand, if the page is to be reclaimed again without being
> dirtied, it will be re-compressed. Compression is not usually slow, and
> a page that was just faulted in is less likely to be reclaimed again
> soon.
>
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -46,6 +46,19 @@ config ZSWAP_DEFAULT_ON
> The selection made here can be overridden by using the kernel
> command line 'zswap.enabled=' option.
>
> +config ZSWAP_EXCLUSIVE_LOADS
> + bool "Invalidate zswap entries when pages are loaded"
> + depends on ZSWAP
> + help
> + If selected, when a page is loaded from zswap, the zswap entry is
> + invalidated at once, as opposed to leaving it in zswap until the
> + swap entry is freed.
> +
> + This avoids having two copies of the same page in memory
> + (compressed and uncompressed) after faulting in a page from zswap.
> + The cost is that if the page was never dirtied and needs to be
> + swapped out again, it will be re-compressed.
So it's a speed-vs-space tradeoff? I'm not sure how users are to
decide whether they want this. Did we help them as much as possible?
next prev parent reply other threads:[~2023-05-30 21:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 21:02 Yosry Ahmed
2023-05-30 21:15 ` Andrew Morton [this message]
2023-05-30 21:20 ` Yosry Ahmed
2023-05-30 23:54 ` Johannes Weiner
2023-05-30 23:56 ` Yosry Ahmed
2023-05-31 6:00 ` Christoph Hellwig
2023-06-07 14:13 ` Johannes Weiner
2023-06-07 16:33 ` Yosry Ahmed
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=20230530141547.609c4a434470c3fbf7570ff8@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cerasuolodomenico@gmail.com \
--cc=ddstreet@ieee.org \
--cc=hannes@cmpxchg.org \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=sjenning@redhat.com \
--cc=vitaly.wool@konsulko.com \
--cc=yosryahmed@google.com \
--cc=yuzhao@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