[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKEwX=Oxa6Ov25ef6uj598jpZY=pFC2pcFrHSD626zuhokhrrQ@mail.gmail.com>
Date: Mon, 2 Dec 2024 16:17:29 -0800
From: Nhat Pham <nphamcs@...il.com>
To: Chengming Zhou <chengming.zhou@...ux.dev>
Cc: Kanchana P Sridhar <kanchana.p.sridhar@...el.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, hannes@...xchg.org, yosryahmed@...gle.com,
usamaarif642@...il.com, ryan.roberts@....com, 21cnbao@...il.com,
akpm@...ux-foundation.org, wajdi.k.feghali@...el.com, vinodh.gopal@...el.com
Subject: Re: [PATCH v1 2/2] mm: zswap: zswap_store_pages() simplifications for batching.
On Wed, Nov 27, 2024 at 11:00 PM Chengming Zhou
<chengming.zhou@...ux.dev> wrote:
>
> How about introducing a `zswap_compress_folio()` interface which
> can be used by `zswap_store()`?
> ```
> zswap_store()
> nr_pages = folio_nr_pages(folio)
>
> entries = zswap_alloc_entries(nr_pages)
>
> ret = zswap_compress_folio(folio, entries, pool)
>
> // store entries into xarray and LRU list
> ```
>
> And this version `zswap_compress_folio()` is very simple for now:
> ```
> zswap_compress_folio()
> nr_pages = folio_nr_pages(folio)
>
> for (index = 0; index < nr_pages; ++index) {
> struct page *page = folio_page(folio, index);
>
> if (!zswap_compress(page, &entries[index], pool))
> return false;
> }
>
> return true;
> ```
> This can be easily extended to support your "batched" version.
>
> Then the old `zswap_store_page()` could be removed.
>
> The good point is simplicity, that we don't need to slice folio
> into multiple batches, then repeat the common operations for each
> batch, like preparing entries, storing into xarray and LRU list...
>
+1.
Powered by blists - more mailing lists