[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260206031509.68313-1-sj@kernel.org>
Date: Thu, 5 Feb 2026 19:15:09 -0800
From: SeongJae Park <sj@...nel.org>
To: "Jiayuan Chen" <jiayuan.chen@...ux.dev>
Cc: SeongJae Park <sj@...nel.org>,
linux-mm@...ck.org,
"Jiayuan Chen" <jiayuan.chen@...pee.com>,
"Johannes Weiner" <hannes@...xchg.org>,
"Michal Hocko" <mhocko@...nel.org>,
"Roman Gushchin" <roman.gushchin@...ux.dev>,
"Shakeel Butt" <shakeel.butt@...ux.dev>,
"Muchun Song" <muchun.song@...ux.dev>,
"Yosry Ahmed" <yosry.ahmed@...ux.dev>,
"Nhat Pham" <nphamcs@...il.com>,
"Chengming Zhou" <chengming.zhou@...ux.dev>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Nick Terrell" <terrelln@...com>,
"David Sterba" <dsterba@...e.com>,
cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] mm: zswap: add per-memcg stat for incompressible pages
On Fri, 06 Feb 2026 02:47:58 +0000 "Jiayuan Chen" <jiayuan.chen@...ux.dev> wrote:
> February 6, 2026 at 10:21, "SeongJae Park" <sj@...nel.org mailto:sj@...nel.org?to=%22SeongJae%20Park%22%20%3Csj%40kernel.org%3E > wrote:
>
>
> >
> > On Thu, 5 Feb 2026 13:30:12 +0800 Jiayuan Chen <jiayuan.chen@...ux.dev> 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
Powered by blists - more mailing lists