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: <CAJD7tkaRrMp2APU=hzEos=oGkW6dW+M8GCzc8D=F1sboXZ_BAw@mail.gmail.com>
Date: Mon, 30 Sep 2024 16:33:29 -0700
From: Yosry Ahmed <yosryahmed@...gle.com>
To: Nhat Pham <nphamcs@...il.com>
Cc: Kanchana P Sridhar <kanchana.p.sridhar@...el.com>, linux-kernel@...r.kernel.org, 
	linux-mm@...ck.org, hannes@...xchg.org, chengming.zhou@...ux.dev, 
	usamaarif642@...il.com, shakeel.butt@...ux.dev, ryan.roberts@....com, 
	ying.huang@...el.com, 21cnbao@...il.com, akpm@...ux-foundation.org, 
	willy@...radead.org, nanhai.zou@...el.com, wajdi.k.feghali@...el.com, 
	vinodh.gopal@...el.com
Subject: Re: [PATCH v9 6/7] mm: zswap: Support large folios in zswap_store().

On Mon, Sep 30, 2024 at 4:29 PM Nhat Pham <nphamcs@...il.com> wrote:
>
> On Mon, Sep 30, 2024 at 4:20 PM Yosry Ahmed <yosryahmed@...gle.com> wrote:
> >
> > On Mon, Sep 30, 2024 at 4:11 PM Nhat Pham <nphamcs@...il.com> wrote:
> >
> > I suggested this in a previous version, and Kanchana faced some
> > complexities implementing it:
> > https://lore.kernel.org/lkml/SJ0PR11MB56785027ED6FCF673A84CEE6C96A2@SJ0PR11MB5678.namprd11.prod.outlook.com/
>
> Sorry, I missed that conversation.
>
> >
> > Basically, if we batch get the refs after the store I think it's not
> > safe, because once an entry is published to writeback it can be
> > written back and freed, and a ref that we never acquired would be
> > dropped.
>
> Hmmm. I don't think writeback could touch any individual subpage just yet, no?
>
> Before doing any work, zswap writeback would attempt to add the
> subpage to the swap cache (via __read_swap_cache_async()). However,
> all subpage will have already been added to swap cache, and point to
> the (large) folio. So zswap_writeback_entry() should short circuit
> here (the if (!page_allocated) case).

If it's safe to take the refs after all calls to zswap_store_page()
are successful, then yeah that should be possible, for both the pool
and objcg. I didn't look closely though.

Just to clarify, you mean grab one ref first, then do the
compressions, then grab the remaining refs, right?

The other thing I would be worried about is code clarity, not sure if
it would be confusing to initialize the entries in zswap_store_page(),
then grab the refs later in zswap_store().

>
> >
> > Getting refs before the store would work, but then if the store fails
> > at an arbitrary page, we need to only drop refs on the pool for pages
> > that were not added to the tree, as the cleanup loop with
> > zswap_entry_free() at the end of zswap_store() will drop the ref for
> > those that were added to the tree.
> >
> > We agreed to (potentially) do the batching for refcounts as a followup.
>
> But yeah no biggie. Not a dealbreaker for me tbh. I thought it was a
> quick change (hence the fixlet suggestion), but if not then let's do
> it as a follow-up.

I don't feel strongly either way.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ