lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJD7tkYwHufwgzBkyycjW=LXYUKB9cS74uDaUseaLDe5mpQ+VA@mail.gmail.com>
Date:   Tue, 30 May 2023 14:20:01 -0700
From:   Yosry Ahmed <yosryahmed@...gle.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
        Seth Jennings <sjenning@...hat.com>,
        Dan Streetman <ddstreet@...e.org>,
        Vitaly Wool <vitaly.wool@...sulko.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Nhat Pham <nphamcs@...il.com>,
        Domenico Cerasuolo <cerasuolodomenico@...il.com>,
        Yu Zhao <yuzhao@...gle.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: zswap: support exclusive loads

On Tue, May 30, 2023 at 2:15 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> On Tue, 30 May 2023 21:02:51 +0000 Yosry Ahmed <yosryahmed@...gle.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?

I assumed that some users want the current behavior, where reclaiming
clean pages that were once in zswap would be faster. If no one cares,
I can remove the config option and have it always on.

>
> > 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?

Yes, it is a reclaim speed vs. space tradeoff.

My intuition is that it should be more useful to have this enabled, as
the memory savings should be more important than having reclaim be a
little bit faster in some specific situations. We can make the
configuration on by default if others agree.

I would imagine users would turn this configuration on and observe
memory usage of zswap vs. reclaim speed, and decide based on the
numbers.

>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ