From: Yosry Ahmed <yosry.ahmed@linux.dev>
To: SeongJae Park <sj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Chengming Zhou <chengming.zhou@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Nhat Pham <nphamcs@gmail.com>,
kernel-team@meta.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH 1/4] mm/zswap: remove unnecessary dlen writes for incompressible pages
Date: Tue, 7 Oct 2025 23:40:21 +0000 [thread overview]
Message-ID: <xdsrooh5v7hdkfzr4rmwg6bmg2kd7wediwk7efjexu3ken3wec@so6hlaxqvafh> (raw)
In-Reply-To: <20251003203851.43128-2-sj@kernel.org>
On Fri, Oct 03, 2025 at 01:38:48PM -0700, SeongJae Park wrote:
> Incompressible pages handling logic in zswap_compress() is setting
> 'dlen' as PAGE_SIZE twice. Once before deciding whether to save the
> content as is, and once again after it is decided to save it as is.
> But the value of 'dlen' is used only if it is decided to save the
> content as is, so the first write is unnecessary. It is not causing
> real user issues, but making code confusing to read. Remove the
> unnecessary write operation.
>
> Signed-off-by: SeongJae Park <sj@kernel.org>
Acked-by: Yosry Ahmed <yosry.ahmed@linux.dev>
> ---
> mm/zswap.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/mm/zswap.c b/mm/zswap.c
> index c1af782e54ec..80619c8589a7 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -894,7 +894,6 @@ static bool zswap_compress(struct page *page, struct zswap_entry *entry,
> * to the active LRU list in the case.
> */
> if (comp_ret || !dlen || dlen >= PAGE_SIZE) {
> - dlen = PAGE_SIZE;
> if (!mem_cgroup_zswap_writeback_enabled(
> folio_memcg(page_folio(page)))) {
> comp_ret = comp_ret ? comp_ret : -EINVAL;
> --
> 2.39.5
next prev parent reply other threads:[~2025-10-07 23:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 20:38 [PATCH 0/4] mm/zswap: misc cleanup of code and documentations SeongJae Park
2025-10-03 20:38 ` [PATCH 1/4] mm/zswap: remove unnecessary dlen writes for incompressible pages SeongJae Park
2025-10-07 23:40 ` Yosry Ahmed [this message]
2025-10-08 15:45 ` Nhat Pham
2025-10-09 3:02 ` Chengming Zhou
2025-10-03 20:38 ` [PATCH 2/4] mm/zswap: fix typos: s/zwap/zswap/ SeongJae Park
2025-10-07 23:40 ` Yosry Ahmed
2025-10-08 15:46 ` Nhat Pham
2025-10-09 3:02 ` Chengming Zhou
2025-10-03 20:38 ` [PATCH 3/4] mm/zswap: s/red-black tree/xarray/ SeongJae Park
2025-10-07 23:41 ` Yosry Ahmed
2025-10-08 15:46 ` Nhat Pham
2025-10-09 3:03 ` Chengming Zhou
2025-10-03 20:38 ` [PATCH 4/4] Docs/admin-guide/mm/zswap: " SeongJae Park
2025-10-07 23:42 ` Yosry Ahmed
2025-10-08 15:48 ` Nhat Pham
2025-10-09 3:03 ` Chengming Zhou
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=xdsrooh5v7hdkfzr4rmwg6bmg2kd7wediwk7efjexu3ken3wec@so6hlaxqvafh \
--to=yosry.ahmed@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--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=sj@kernel.org \
/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