Re: [PATCH v1] mm: zswap: add per-memcg stat for incompressible pages
From: SeongJae Park
Date: Thu Feb 05 2026 - 22:15:25 EST
On Fri, 06 Feb 2026 02:47:58 +0000 "Jiayuan Chen" <jiayuan.chen@xxxxxxxxx> wrote:
> February 6, 2026 at 10:21, "SeongJae Park" <sj@xxxxxxxxxx mailto:sj@xxxxxxxxxx?to=%22SeongJae%20Park%22%20%3Csj%40kernel.org%3E > wrote:
>
>
> >
> > On Thu, 5 Feb 2026 13:30:12 +0800 Jiayuan Chen <jiayuan.chen@xxxxxxxxx> wrote:
[...]
> > > @@ -941,7 +941,7 @@ static bool zswap_decompress(struct zswap_entry *entry, struct folio *folio)
> > > zs_obj_read_sg_begin(pool->zs_pool, entry->handle, input, entry->length);
> > >
> > > /* zswap entries of length PAGE_SIZE are not compressed. */
> > > - if (entry->length = PAGE_SIZE) {
> > > + if (zswap_is_raw(entry->length)) {
> > > WARN_ON_ONCE(input->length != PAGE_SIZE);
> > > memcpy_from_sglist(kmap_local_folio(folio, 0), input, 0, PAGE_SIZE);
> > > dlen = PAGE_SIZE;
> > >
> > Below this part, I show 'dlen = PAGE_SIZE'. Should it also be converted to
> > use the helper function?
> >
>
> The dlen variable represents the decompressed (plaintext) size.
> Since we compress individual pages, the decompressed output should
> always be PAGE_SIZE in normal cases.
>
> This check validates whether decompression produced the expected result, not whether the entry is incompressible.
>
> Using zswap_is_incomp() here would be semantically incorrect - the helper is meant to check if an
> entry was stored without compression (i.e., compression failed to reduce size), while dlen = PAGE_SIZE
> verifies the output of decompression is valid.
You are right. Thank you for kindly correcting me.
Thanks,
SJ