All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Hui Zhu <hui.zhu@linux.dev>
Cc: Minchan Kim <minchan@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 teawater <zhuhui@kylinos.cn>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH] zsmalloc: return -EAGAIN for zspage migration lock contention
Date: Wed, 18 Mar 2026 19:31:50 +0900	[thread overview]
Message-ID: <abp9uCoPwM9EhdPZ@google.com> (raw)
In-Reply-To: <abp7HJRZQi35wHn-@google.com>

On (26/03/18 19:21), Sergey Senozhatsky wrote:
> On (26/03/18 15:31), Hui Zhu wrote:
> > 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.
> 
> The zspage's reader-lock owner can be preempted for unknown duration,
> so I don't know if returning -EAGAIN is safe.  On one hand, migration
> attempts are limited by NR_MAX_MIGRATE_PAGES_RETRY, on the other hand,
> those attempts are performed basically immediately (?), I'm not sure
> if we have good chances for preempted reader-lock owner to get scheduled
> and release the lock in time.

.. or reader-lock owner can simply perform decompression with
a very slow algorithm (e.g. deflate) which can taks significantly
more time than NR_MAX_MIGRATE_PAGES_RETRY migration atteempts.

So I agree that -EINVAL is not the best error code to return here.
Not sure if -EAGAIN is the best one either.  Technically, -EBUSY can
be a candidate (this is not exactly what migration code expects and
-EBUSY is not any better than -EINVAL as it's still going to be a
terminal error).


      reply	other threads:[~2026-03-18 10:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18  7:31 [PATCH] zsmalloc: return -EAGAIN for zspage migration lock contention Hui Zhu
2026-03-18 10:21 ` Sergey Senozhatsky
2026-03-18 10:31   ` 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=abp9uCoPwM9EhdPZ@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 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.