From: SeongJae Park <sj@kernel.org>
To: Nhat Pham <nphamcs@gmail.com>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Chengming Zhou <chengming.zhou@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Takero Funaki <flintglass@gmail.com>,
Yosry Ahmed <yosry.ahmed@linux.dev>,
kernel-team@meta.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [RFC PATCH] mm/zswap: store compression failed page as-is
Date: Thu, 31 Jul 2025 09:43:56 -0700 [thread overview]
Message-ID: <20250731164356.15198-1-sj@kernel.org> (raw)
In-Reply-To: <CAKEwX=Py+yvxtR5zt-1DtskhGWWHkRP_h8kneEHSrcQ947=m9Q@mail.gmail.com>
On Wed, 30 Jul 2025 17:22:51 -0700 Nhat Pham <nphamcs@gmail.com> wrote:
> On Wed, Jul 30, 2025 at 5:21 PM Nhat Pham <nphamcs@gmail.com> wrote:
> >
> > On Wed, Jul 30, 2025 at 4:41 PM SeongJae Park <sj@kernel.org> wrote:
> >
> > This might not be safe.
> >
> > It's conceivable that in zswap_compress(), some compression algorithm
> > "successfully" compresses a page to the same size (comp_ret == 0). We
> > hand that to zsmalloc, which happily stores the page.
> >
> > When we "decompress" the page again, we will attempt to
> > memcpy_to_folio from a bogus address (the handle from zsmalloc).
> >
> > So, in zswap_compress, you have to treat both comp_ret == 0 and dlen
> > == PAGE_SIZE as "compression failure".
>
> Meant to say comp_ret != 0 here... sorry for the confusion...
No worry, thank you for clarifying!
Thanks,
SJ
next prev parent reply other threads:[~2025-07-31 16:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 23:40 [RFC PATCH] mm/zswap: store compression failed page as-is SeongJae Park
2025-07-31 0:21 ` Nhat Pham
2025-07-31 0:22 ` Nhat Pham
2025-07-31 16:43 ` SeongJae Park [this message]
2025-07-31 16:43 ` SeongJae Park
2025-07-31 0:48 ` Nhat Pham
2025-07-31 16:56 ` SeongJae Park
2025-07-31 15:27 ` Johannes Weiner
2025-07-31 17:09 ` SeongJae Park
2025-07-31 18:16 ` Johannes Weiner
2025-07-31 17:20 ` Joshua Hahn
2025-08-01 19:57 ` 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=20250731164356.15198-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=flintglass@gmail.com \
--cc=hannes@cmpxchg.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.