From: SeongJae Park <sj@kernel.org>
To: Barry Song <21cnbao@gmail.com>
Cc: SeongJae Park <sj@kernel.org>, Nhat Pham <nphamcs@gmail.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Andrew Morton <akpm@linux-foundation.org>,
Chengming Zhou <chengming.zhou@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Yosry Ahmed <yosry.ahmed@linux.dev>,
kernel-team@meta.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Takero Funaki <flintglass@gmail.com>,
David Hildenbrand <david@redhat.com>, Baoquan He <bhe@redhat.com>,
Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>
Subject: Re: [PATCH v4] mm/zswap: store <PAGE_SIZE compression failed page as-is
Date: Thu, 21 Aug 2025 09:42:55 -0700 [thread overview]
Message-ID: <20250821164255.78596-1-sj@kernel.org> (raw)
In-Reply-To: <CAGsJ_4yLDLvOZ2=3iVcQhu2jnbWQ+iTQsqVefJsx4_YT4bnEZg@mail.gmail.com>
On Thu, 21 Aug 2025 18:27:52 +0800 Barry Song <21cnbao@gmail.com> wrote:
> On Thu, Aug 21, 2025 at 1:33 AM Nhat Pham <nphamcs@gmail.com> wrote:
> >
> > On Tue, Aug 19, 2025 at 6:37 PM Herbert Xu <herbert@gondor.apana.org.au> 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?
Is there a reason to wait? I was thinking those are orthogonal problems?
Anyway, for the counter (crypto_compress_fail), I don't have a strong opinion.
To my understanding, the options for path forward are...
1. remove it,
2. keep it as is, or
3. keep it, but account only -EINPROGRESS[1]
If I'm not missing other options, I'm tempted to the first option (remove it)
since it doesn't change any existing things, and we can revisit later.
Please let me know if I'm missing another options or you have other preferrence
on what option to take.
> 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);
> + }
Nice catch, thank you Berry. Actually there was a check for keeping the code
reachable, but I forgot keeping it while updating the version from v3[2] to
this one. I will make below change on the next version to restore it.
@@ -992,7 +992,7 @@ static bool zswap_compress(struct page *page, struct zswap_entry *entry,
if (dlen >= PAGE_SIZE) {
if (!mem_cgroup_zswap_writeback_enabled(
folio_memcg(page_folio(page)))) {
- comp_ret = -EINVAL;
+ comp_ret = comp_ret ? comp_ret : -EINVAL;
goto unlock;
}
comp_ret = 0;
[1] https://lore.kernel.org/CAF8kJuPPsLzWu8+xm2A_UPHMBhb7OTjJNErM1Kp3hPmvHXNDUQ@mail.gmail.com
[2] https://lore.kernel.org/20250815213020.89327-1-sj@kernel.org
Thanks,
SJ
next prev parent reply other threads:[~2025-08-21 16:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 19:34 [PATCH v4] mm/zswap: store <PAGE_SIZE compression failed page as-is SeongJae Park
2025-08-20 1:13 ` Barry Song
2025-08-20 1:20 ` Herbert Xu
2025-08-20 1:34 ` Barry Song
2025-08-20 1:37 ` Herbert Xu
2025-08-20 17:32 ` Nhat Pham
2025-08-21 10:27 ` Barry Song
2025-08-21 16:42 ` SeongJae Park [this message]
2025-08-21 20:49 ` Chris Li
2025-08-21 21:36 ` SeongJae Park
2025-08-22 0:48 ` Barry Song
2025-08-22 5:54 ` Herbert Xu
2025-08-22 7:30 ` Barry Song
2025-08-22 16:44 ` SeongJae Park
2025-08-20 5:07 ` Chris Li
2025-08-20 5:10 ` Herbert Xu
2025-08-20 5:20 ` Chris Li
2025-08-20 5:22 ` Herbert Xu
2025-08-21 20:42 ` Chris Li
2025-08-20 4:55 ` Chris Li
2025-08-20 4:49 ` Chris Li
2025-08-21 16:17 ` SeongJae Park
2025-08-21 21:21 ` Chris Li
2025-08-21 21:41 ` SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250821164255.78596-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=chengming.zhou@linux.dev \
--cc=chrisl@kernel.org \
--cc=david@redhat.com \
--cc=flintglass@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=herbert@gondor.apana.org.au \
--cc=kasong@tencent.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=yosry.ahmed@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).