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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 2 Nov 2023 16:50:22 -0400
From:   Johannes Weiner <hannes@...xchg.org>
To:     Yosry Ahmed <yosryahmed@...gle.com>
Cc:     Nhat Pham <nphamcs@...il.com>, akpm@...ux-foundation.org,
        tj@...nel.org, lizefan.x@...edance.com,
        cerasuolodomenico@...il.com, sjenning@...hat.com,
        ddstreet@...e.org, vitaly.wool@...sulko.com, mhocko@...nel.org,
        roman.gushchin@...ux.dev, shakeelb@...gle.com,
        muchun.song@...ux.dev, hughd@...gle.com, corbet@....net,
        konrad.wilk@...cle.com, senozhatsky@...omium.org, rppt@...nel.org,
        linux-mm@...ck.org, kernel-team@...a.com,
        linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
        david@...t.cz
Subject: Re: [RFC PATCH v2] zswap: memcontrol: implement zswap writeback
 disabling

On Thu, Nov 02, 2023 at 01:27:24PM -0700, Yosry Ahmed wrote:
> On Thu, Nov 2, 2023 at 1:02 PM Nhat Pham <nphamcs@...il.com> wrote:
> > @@ -201,6 +201,12 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
> >                 folio_end_writeback(folio);
> >                 return 0;
> >         }
> > +
> > +       if (!mem_cgroup_zswap_writeback_enabled(folio_memcg(folio))) {
> > +               folio_mark_dirty(folio);
> > +               return AOP_WRITEPAGE_ACTIVATE;
> > +       }
> > +
> 
> I am not a fan of this, because it will disable using disk swap if
> "zswap_writeback" is disabled, even if zswap is disabled or the page
> was never in zswap. The term zswap_writeback makes no sense here tbh.
> 
> I am still hoping someone else will suggest better semantics, because
> honestly I can't think of anything. Perhaps something like
> memory.swap.zswap_only or memory.swap.types which accepts a string
> (e.g. "zswap"/"all",..).

I had suggested the writeback name.

My thinking was this: from a user pov, the way zswap is presented and
described, is a fast writeback cache that sits on top of swap. It's
implemented as this lookaside thing right now, but that's never how it
was sold. And frankly, that's not how it's expected to work, either.

>From the docs:

  Zswap is a lightweight compressed cache for swap pages.

  Zswap evicts pages from compressed cache on an LRU basis to the
  backing swap device when the compressed pool reaches its size limit.

When zswap is enabled, IO to the swap device is expected to come from
zswap. Everything else would be a cache failure. There are a few cases
now where zswap rejects and bypasses to swap. It's not a stretch to
call them accelerated writeback or writethrough. But also, these
represent failures and LRU inversions, we're working on fixing them.

So from a user POV it's reasonable to say if I have zswap enabled and
disable writeback, I don't expect swapfile IO.

But yes, if zswap isn't enabled at all, this shouldn't prevent pages
from going to swap.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ