Re: [RFC PATCH] mm/zswap: store compression failed page as-is
From: Johannes Weiner
Date: Thu Jul 31 2025 - 14:16:48 EST
On Thu, Jul 31, 2025 at 10:09:22AM -0700, SeongJae Park wrote:
> On Thu, 31 Jul 2025 11:27:01 -0400 Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
> > So if compression fails, still do zpool_malloc(), but for PAGE_SIZE
> > and copy over the uncompressed page contents.
> >
> > struct zswap_entry has a hole after bool referenced, so you can add a
> > flag to mark those uncompressed entries at no extra cost.
> >
> > Then you can detect this case in zswap_decompress() and handle the
> > uncompressed copy into @folio accordingly.
>
> I think we could still use 'zswap_entry->length == PAGE_SIZE' as the indicator,
> As long as we ensure that always means the content is incompressed, following
> Nhat's suggestion[1].
>
> Please let me know if I'm missing something.
Ah, right. So if compression succeeds but the result is still
PAGE_SIZE you will treat it as failure and store it uncompressed. Then
PAGE_SIZE always means uncompressed for the readers.
Even better.