public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Hui Zhu <hui.zhu@linux.dev>, Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>,
	 Sergey Senozhatsky <senozhatsky@chromium.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 teawater <zhuhui@kylinos.cn>
Subject: Re: [PATCH v2] zsmalloc: return -EBUSY for zspage migration lock contention
Date: Thu, 19 Mar 2026 12:24:32 +0900	[thread overview]
Message-ID: <abtrxh5Jhrw1yHRO@google.com> (raw)
In-Reply-To: <20260319030709.62556-1-hui.zhu@linux.dev>

On (26/03/19 11:07), Hui Zhu wrote:
> movable_operations::migrate_page() should return an appropriate error
> code for temporary migration failures so the migration core can handle
> them correctly.
> 
> zs_page_migrate() currently returns -EINVAL when zspage_write_trylock()
> fails. That path reflects transient lock contention, not invalid input,
> so -EINVAL is clearly wrong.
> 
> However, -EAGAIN is also inappropriate here: the zspage's reader-lock
> owner may hold the lock for an unbounded duration due to slow
> decompression. Since migration retries are bounded by
> NR_MAX_MIGRATE_PAGES_RETRY and performed with virtually no delay between
> attempts, there is no guarantee the lock will be released in time for a
> retry to succeed. -EAGAIN implies "try again soon", which does not hold
> in this case.
> 
> Return -EBUSY instead, which more accurately conveys that the resource
> is occupied and migration cannot proceed at this time.
> 
> Changelog:
> v2:
> According to the comments of Sergey Senozhatsky, change from -EAGAIN to
> -EBUSY and add comments.

I assume this Changelog was supposed to be under "---".

> +		/*
> +		 * Return -EBUSY but not -EAGAIN: the zspage's reader-lock
> +		 * owner may hold the lock for an unbounded duration due to a
> +		 * slow decompression.
		^^^ or reader-lock owner preemption

> +		 * Since migration retries are bounded by
> +		 * NR_MAX_MIGRATE_PAGES_RETRY and performed with virtually no
> +		 * delay between attempts, there is no guarantee the lock will
> +		 * be released in time for a retry to succeed.
> +		 * -EAGAIN implies "try again soon", which does not hold here.
> +		 * -EBUSY more accurately conveys "resource is occupied,
> +		 * migration cannot proceed".
> +		 */
> +		return -EBUSY;
>  	}

Otherwise,
Acked-by: Sergey Senozhatsky <senozhatsky@chromium.org>


      reply	other threads:[~2026-03-19  3:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19  3:07 [PATCH v2] zsmalloc: return -EBUSY for zspage migration lock contention Hui Zhu
2026-03-19  3:24 ` Sergey Senozhatsky [this message]

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=abtrxh5Jhrw1yHRO@google.com \
    --to=senozhatsky@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=hui.zhu@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.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