From nobody Thu Apr 2 14:14:21 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C6DD533DEE1 for ; Sat, 28 Mar 2026 19:52:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774727551; cv=none; b=nxC2WzzB7fGbNp8Y6Mh8HhIolt0HE1nsQH93WbnW9bRwu1E8uWnRJPQpyUZmwg3/0t//2wQUAtZ72go6CWiCc3Xp3t62ZsZpezjyo2fvdUmA/hPV3P0VQOoAJfGIlwzgtRBfgNl8kp1FU7NwUuxXlsEwlKOzMiAFJ82yB+oCHBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774727551; c=relaxed/simple; bh=9RYTKEAJRgR1YdnkgRQ1TL6l1lNmoU9ISlURLEfdnOc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZgzPXUbkUwcbw0y1Fo2o/q5kJcXu/RSCFTqk2xsXfBQyTFQ8fiYDhsqqZQQUdX0eEYr6IAxu3Q4WScVH1OsVbWdxa+6CyEN9ZFlcOtvv+AQxLuFPr9m9GeE4yc8cb3swuM+3qI6v0Kq8dCArm2g0cHaqEXPancydFJYbI7p7m38= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m30IZSSt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m30IZSSt" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8C727C2BCB7; Sat, 28 Mar 2026 19:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774727551; bh=9RYTKEAJRgR1YdnkgRQ1TL6l1lNmoU9ISlURLEfdnOc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=m30IZSStpoMQAFUGwaOgmsw4ZwFX45+LZcRMyl3QI/3+RagpckMezSfJX7J2/22iw cqP2t6MlKoHYPIulg/Z39xYqxGedJJB6mqlU2td6SXhGd0kfZVNuqnShX4/FdnhcHZ oAYe0PdOl//iaFu+9eT7w2oG/e4T3yC3YxcLpGYmUjSb1pVppHKrUshi+8drg8QpC9 23Mpq8iFiPezNIAgkqeE+lcuVWIv/ndft3zOLqeuWXwRKvWshlQ19wKwCScTJcSLsR ViwJncWuy7OLtPW197RzbqdyOtWUbH85v1rGLCCov39JVY3wRm1bE3S39Y5pyruoVk T249p7idh6sxA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 810D110F3DF9; Sat, 28 Mar 2026 19:52:31 +0000 (UTC) From: Kairui Song via B4 Relay Date: Sun, 29 Mar 2026 03:52:32 +0800 Subject: [PATCH v2 06/12] mm/mglru: use a smaller batch for reclaim Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260329-mglru-reclaim-v2-6-b53a3678513c@tencent.com> References: <20260329-mglru-reclaim-v2-0-b53a3678513c@tencent.com> In-Reply-To: <20260329-mglru-reclaim-v2-0-b53a3678513c@tencent.com> To: linux-mm@kvack.org Cc: Andrew Morton , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Qi Zheng , Shakeel Butt , Lorenzo Stoakes , Barry Song , David Stevens , Chen Ridong , Leno Hou , Yafang Shao , Yu Zhao , Zicheng Wang , Kalesh Singh , Suren Baghdasaryan , Chris Li , Vernon Yang , linux-kernel@vger.kernel.org, Qi Zheng , Baolin Wang , Kairui Song X-Mailer: b4 0.15.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774727549; l=936; i=kasong@tencent.com; s=kasong-sign-tencent; h=from:subject:message-id; bh=6K0YJ01vwTDlwxdVK6T6C7w8M/m2BxZNiHO5rSzz1FE=; b=8DgFu7uQ3AkTL1Pq/A9upGeJPa79VkafPA7++cGACubDswHq0qwjZ+vbUYGkcJ7y7NOk/SXTx 9JwMempDtZXB5nOiT7OH7aDm9f783s+i8S83OrtP7RixGD+8N4asqOh X-Developer-Key: i=kasong@tencent.com; a=ed25519; pk=kCdoBuwrYph+KrkJnrr7Sm1pwwhGDdZKcKrqiK8Y1mI= X-Endpoint-Received: by B4 Relay for kasong@tencent.com/kasong-sign-tencent with auth_id=562 X-Original-From: Kairui Song Reply-To: kasong@tencent.com From: Kairui Song With a fixed number to reclaim calculated at the beginning, making each following step smaller should reduce the lock contention and avoid over-aggressive reclaim of folios, as it will abort earlier when the number of folios to be reclaimed is reached. Reviewed-by: Axel Rasmussen Reviewed-by: Chen Ridong Signed-off-by: Kairui Song Reviewed-by: Baolin Wang --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index c5361efa6776..e3ca38d0c4cd 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5004,7 +5004,7 @@ static bool try_to_shrink_lruvec(struct lruvec *lruve= c, struct scan_control *sc) break; } =20 - nr_batch =3D min(nr_to_scan, MAX_LRU_BATCH); + nr_batch =3D min(nr_to_scan, MIN_LRU_BATCH); delta =3D evict_folios(nr_batch, lruvec, sc, swappiness); if (!delta) break; --=20 2.53.0