Re: [PATCH v4] mm/zswap: store <PAGE_SIZE compression failed page as-is
From: Barry Song
Date: Thu Aug 21 2025 - 06:31:04 EST
On Thu, Aug 21, 2025 at 1:33 AM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
>
> On Tue, Aug 19, 2025 at 6:37 PM Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Wed, Aug 20, 2025 at 01:34:01PM +1200, Barry Song wrote:
> > >
> > > We might want to revisit the old thread to check whether it is now safe for us
> > > to move to PAGE_SIZE in zswap now.
> >
> > It's perfectly safe as LZO was fixed months ago.
>
> Perfect. Then I'll revive Chengming's patch (see [1]) to reduce the
> compression buffer :)
Nice!
But perhaps we should wait until SeongJae sends a new version that
addresses the counter issue? Also, I noticed the following code may
have problems with the patch:
if (comp_ret == -ENOSPC || alloc_ret == -ENOSPC)
zswap_reject_compress_poor++;
Can we still reach the code comp_ret == -ENOSPC since we already
handled comp_ret by ...
+ if (comp_ret || !dlen) {
+ zswap_crypto_compress_fail++;
+ dlen = PAGE_SIZE;
+ }
+ if (dlen >= PAGE_SIZE) {
+ if (!mem_cgroup_zswap_writeback_enabled(
+ folio_memcg(page_folio(page)))) {
+ comp_ret = -EINVAL;
+ goto unlock;
+ }
+ comp_ret = 0;
+ dlen = PAGE_SIZE;
+ dst = kmap_local_page(page);
+ }
Thanks
Barry