From nobody Mon Apr 6 19:36:40 2026 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D90332DCF41 for ; Wed, 18 Mar 2026 07:31:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773819109; cv=none; b=q3hrNJr6evwAUqz8cBOTZ6jF2KHJvBS5BQvCfP2AaRYvJH1YO3krbvOxaFlPPQfItu2Et/1dah0xlMBNEDsofDcr4bMPegTwwiAW3WcdeEA3hMKRvOgxig+noMXNjQBYq0g/h9s6BBKfjMqyh00LJcqtKFMbhDkbR+Y5yUmO7OM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773819109; c=relaxed/simple; bh=cn1OsDThKoCmSxfx+iJ4C77wfIO2237qkr/zNu5vSbU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XipGSIr+ZG24+o1hbhiIRDCgePvC/dvVkE4KAovUTef8GUOE4q7UJR66BFrbD9yYjHjawof0a1dWzNHnadmq6tQJvOBLMhjtDUUvRMs94kQPV7lIuh8TOsq8G1nMPTourz6/vHZim+fDiDNPMH/kT9tYKehFBkf63P7z7cgqK/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Q6yEcEXC; arc=none smtp.client-ip=91.218.175.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Q6yEcEXC" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1773819105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=4eK33YHoFdr17RO57NYgTKQzBSCrnmY/AC+hh3sskTE=; b=Q6yEcEXCwrotndBsaTdAD2UOU8SMZjsDebOqSSK2242NaXKEKNJ3dKWnj6cw6tXauhJ5+3 ApvoZjdH9enWf65rTpw1azIL+hxtPAvrNqvw3cU5EJOtgX9b83CFDe3PBznVVOhGk6lARP IUBG6TkMDoGA4VvfgawI5hyyhxRPwc0= From: Hui Zhu To: Minchan Kim , Sergey Senozhatsky , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: teawater Subject: [PATCH] zsmalloc: return -EAGAIN for zspage migration lock contention Date: Wed, 18 Mar 2026 15:31:14 +0800 Message-ID: <20260318073114.34858-1-hui.zhu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: teawater 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 --- 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, stru= ct page *page, if (!zspage_write_trylock(zspage)) { spin_unlock(&class->lock); write_unlock(&pool->lock); - return -EINVAL; + return -EAGAIN; } =20 /* We're committed, tell the world that this is a Zsmalloc page. */ --=20 2.43.0