From: Andrew Morton <akpm@linux-foundation.org>
To: Baoquan He <baoquan.he@linux.dev>
Cc: Baoquan He <hebaoquan@kylinos.cn>,
hannes@cmpxchg.org, yosry@kernel.org, nphamcs@gmail.com,
chengming.zhou@linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, kasong@tencent.com,
chrisl@kernel.org
Subject: Re: [PATCH] mm: zswap: return -ENOENT when the swap device is gone
Date: Mon, 14 Sep 2026 21:16:58 -0700 [thread overview]
Message-ID: <20260914211658.644e5b9b61405f4a9460b8df@linux-foundation.org> (raw)
In-Reply-To: <aqeUyxJmzC397G7j@fedora>
On Mon, 14 Sep 2026 14:31:39 +0800 Baoquan He <baoquan.he@linux.dev> wrote:
> >
> > > si = get_swap_device(swpentry);
> > > if (!si)
> > > - return -EEXIST;
> > > + return -ENOENT;
> >
> > mm-new has changed. I made this
>
> Thanks. Does it need a v2? or just use ther version you tuned.
I fixed it up while fixing the rejects, I hope. Below.
> By the way, which mm branch is suggested to take as a base for mm
> patches posting? I usually take mm-unstable branch, seems it's changed
> to mm-new now?
mm-new is a front-end to mm-unstable. The only difference is that
mm-new isn't included in linux-next. New material goes into mm-new and
if it hasn't caused any disasters for a few days I'll move it into
mm-unstable and hence linux-next.
Ordinarily there isn't much material in mm-new. At this moment
mm-unstable has 405 patches and mm-new has another 96. That 96 is
unusually large because people have been sending huge patchsets today.
So mm-new is the best target for my merging pleasure but it is surely a
pain for ongoing development - it's changing at a great rate. Those
500 patches landed in 15 days.
I suggest a reasonable process is, approximately, to develop against
mainline (or mm-stable if there's anything in it) until you think the
code is ready for mm.git. Then rebase/retest against mm-new and send
it out. But keep an eye on what's happening in mm.git so that the
rebasing doesn't cause nasty surprises.
From: Baoquan He <hebaoquan@kylinos.cn>
Subject: mm: zswap: return -ENOENT when the swap device is gone
Date: Sun, 13 Sep 2026 14:30:31 +0800
zswap_writeback_entry() returns -EEXIST when get_swap_device() finds no
device. -EEXIST is the shrinker's "page already in swap cache" signal,
which makes zswap_shrinker_scan() stop shrinking entirely. A NULL
get_swap_device() instead means the device is being swapped off, so the
entry is simply stale.
Return -ENOENT so the shrinker skips the stale entry and keeps scanning.
Independent of xswap; affects all swap devices.
Link: https://lore.kernel.org/20260913063031.1689420-1-hebaoquan@kylinos.cn
Signed-off-by: Baoquan He <hebaoquan@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Nhat Pham <nphamcs@gmail.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Chris Li <chrisl@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kairui Song <kasong@tencent.com>
---
mm/zswap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/zswap.c~mm-zswap-return-enoent-when-the-swap-device-is-gone
+++ a/mm/zswap.c
@@ -1016,7 +1016,7 @@ static int zswap_writeback_entry(struct
/* try to allocate swap cache folio */
si = get_swap_device(swpentry);
if (IS_ERR_OR_NULL(si))
- return -EEXIST;
+ return -ENOENT;
mpol = get_task_policy(current);
folio = swap_cache_alloc_folio(swpentry, GFP_KERNEL, BIT(0), NULL, mpol,
_
next prev parent reply other threads:[~2026-09-15 4:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 6:30 Baoquan He
2026-09-13 7:48 ` Andrew Morton
2026-09-14 6:27 ` Baoquan He
2026-09-13 7:51 ` Andrew Morton
2026-09-14 6:31 ` Baoquan He
2026-09-15 4:16 ` Andrew Morton [this message]
2026-09-15 5:22 ` Baoquan He
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=20260914211658.644e5b9b61405f4a9460b8df@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=baoquan.he@linux.dev \
--cc=chengming.zhou@linux.dev \
--cc=chrisl@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hebaoquan@kylinos.cn \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=yosry@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
all inboxes | Powered by JetHome®