From: Hui Zhu <hui.zhu@linux.dev>
To: Minchan Kim <minchan@kernel.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: teawater <zhuhui@kylinos.cn>
Subject: [PATCH] zsmalloc: return -EAGAIN for zspage migration lock contention
Date: Wed, 18 Mar 2026 15:31:14 +0800 [thread overview]
Message-ID: <20260318073114.34858-1-hui.zhu@linux.dev> (raw)
From: teawater <zhuhui@kylinos.cn>
movable_operations::migrate_page() should return -EAGAIN for temporary
migration failures so the migration core can retry. Other negative
errors are treated as permanent failures.
zs_page_migrate() currently returns -EINVAL when zspage_write_trylock()
fails. That path reflects transient lock contention, not invalid input.
Returning -EINVAL misclassifies the failure and can reduce migration
success under contention.
Return -EAGAIN in this path.
Fixes: e27af3f9360e ("zsmalloc: sleepable zspage reader-lock")
Signed-off-by: teawater <zhuhui@kylinos.cn>
---
mm/zsmalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 2c1430bf8d57..1d26eda7f50c 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1727,7 +1727,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
if (!zspage_write_trylock(zspage)) {
spin_unlock(&class->lock);
write_unlock(&pool->lock);
- return -EINVAL;
+ return -EAGAIN;
}
/* We're committed, tell the world that this is a Zsmalloc page. */
--
2.43.0
next reply other threads:[~2026-03-18 7:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 7:31 Hui Zhu [this message]
2026-03-18 10:21 ` [PATCH] zsmalloc: return -EAGAIN for zspage migration lock contention Sergey Senozhatsky
2026-03-18 10:31 ` Sergey Senozhatsky
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=20260318073114.34858-1-hui.zhu@linux.dev \
--to=hui.zhu@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=senozhatsky@chromium.org \
--cc=zhuhui@kylinos.cn \
/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