Re: [PATCH v4] mm/zswap: store <PAGE_SIZE compression failed page as-is
From: Barry Song
Date: Tue Aug 19 2025 - 21:34:35 EST
On Wed, Aug 20, 2025 at 1:21 PM Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Wed, Aug 20, 2025 at 01:13:13PM +1200, Barry Song wrote:
> >
> > Let’s sync with Herbert: have we reached the stage where all drivers
> > reliably return -ENOSPC when dst_buf is PAGE_SIZE but the compressed
> > size would exceed it?
>
> It doesn't matter. Software compression should never fail, and
> if it does fail due to a bug, that's not something that the user
> of the API should worry about.
>
> Hardware compression should always fall back to software compression
> in case of failure.
>
> IOW all compression errors should be treated as incompressible
> data.
That is why I think it makes little sense to add a counter
zswap_crypto_compress_fail, since zswap already passes 2*PAGE_SIZE as
dst_buf, which is large enough to hold even incompressible data. Adding
a counter that will always stay at zero seems meaningless.
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.
Thanks
Barry