RE: [PATCH v11 23/24] mm: zswap: zswap_store() will process a large folio in batches.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Barry Song <21cnbao@xxxxxxxxx>
> Sent: Thursday, August 28, 2025 5:00 PM
> To: Sridhar, Kanchana P <kanchana.p.sridhar@xxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx;
> hannes@xxxxxxxxxxx; yosry.ahmed@xxxxxxxxx; nphamcs@xxxxxxxxx;
> chengming.zhou@xxxxxxxxx; usamaarif642@xxxxxxxxx;
> ryan.roberts@xxxxxxx; ying.huang@xxxxxxxxxxxxxxxxx; akpm@linux-
> foundation.org; senozhatsky@xxxxxxxxxxxx; linux-crypto@xxxxxxxxxxxxxxx;
> herbert@xxxxxxxxxxxxxxxxxxx; davem@xxxxxxxxxxxxx;
> clabbe@xxxxxxxxxxxx; ardb@xxxxxxxxxx; ebiggers@xxxxxxxxxx;
> surenb@xxxxxxxxxx; Accardi, Kristen C <kristen.c.accardi@xxxxxxxxx>;
> Gomes, Vinicius <vinicius.gomes@xxxxxxxxx>; Feghali, Wajdi K
> <wajdi.k.feghali@xxxxxxxxx>; Gopal, Vinodh <vinodh.gopal@xxxxxxxxx>
> Subject: Re: [PATCH v11 23/24] mm: zswap: zswap_store() will process a
> large folio in batches.
> 
> On Fri, Aug 1, 2025 at 4:36 PM Kanchana P Sridhar
> <kanchana.p.sridhar@xxxxxxxxx> wrote:
> >
> > This patch modifies zswap_store() to store a batch of pages in large
> > folios at a time, instead of storing one page at a time. It does this by
> > calling a new procedure zswap_store_pages() with a range of
> > "pool->batch_size" indices in the folio.
> >
> > zswap_store_pages() implements all the computes done earlier in
> > zswap_store_page() for a single-page, for multiple pages in a folio,
> > namely the "batch":
> >
> > 1) It starts by allocating all zswap entries required to store the
> >    batch. New procedures, zswap_entries_cache_alloc_batch() and
> >    zswap_entries_cache_free_batch() call kmem_cache_[free]alloc_bulk()
> >    to optimize the performance of this step.
> >
> > 2) Next, the entries fields are written, computes that need to be happen
> >    anyway, without modifying the zswap xarray/LRU publishing order. This
> >    improves latency by avoiding having the bring the entries into the
> >    cache for writing in different code blocks within this procedure.
> >
> > 3) Next, it calls zswap_compress() to sequentially compress each page in
> >    the batch.
> >
> > 4) Finally, it adds the batch's zswap entries to the xarray and LRU,
> >    charges zswap memory and increments zswap stats.
> >
> > 5) The error handling and cleanup required for all failure scenarios
> >    that can occur while storing a batch in zswap are consolidated to a
> >    single "store_pages_failed" label in zswap_store_pages(). Here again,
> >    we optimize performance by calling kmem_cache_free_bulk().
> >
> > Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@xxxxxxxxx>
> > ---
> >  mm/zswap.c | 218 ++++++++++++++++++++++++++++++++++++-------------
> ----
> >  1 file changed, 149 insertions(+), 69 deletions(-)
> 
> This seems fine overall. However, could we pull some data from the
> cover letter. For example, even with hardware batching, we are still
> improving performance. Since your cover letter is very long, readers
> might fail to connect this data with the patches.

Sure, will add the data in the commit log.

Thanks,
Kanchana

> 
> Thanks
> Barry




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux