From nobody Mon Apr 6 15:29:00 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 B7B95371CF5 for ; Thu, 2 Apr 2026 18:53:41 +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=1775156021; cv=none; b=UO7ro8RuqalGqEv9wWswLUEyo5QF7Uoe2lx4g6qdBq3RFp/33vEjShuaT2fiOMzFT8k6j4Sg0mTINN1vpsAkRxdeXqPQZcnWw9V6F72trG4UC1LCh1dW3+N7uN8uWhvUOx3qlEKhgdsQoA2TAtzf6j8HNXwFJ916MUGN+JM0UPc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775156021; c=relaxed/simple; bh=x2iJwRWxsNWZo0hiLp3oKxL+smbwMKj3xOseviAzoms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lPDVWTAmRwisywze1RA0RFRVNp2ntGa0CWla3q53H1j+tsOFZ+M1QyXhYpq5tZRaD9R56nyaDB0NgwxHngRTdIzYLsfhkCMMCbL/bUO5io85oubc9kJdjmlEMEFEtGtd5ZiCrPM5V2RwooZ4dE6IWZjM3yT96BEIN0+qIUuX7XA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cm6w2Vkg; 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="cm6w2Vkg" Received: by smtp.kernel.org (Postfix) with ESMTPS id 89325C2BCB7; Thu, 2 Apr 2026 18:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775156021; bh=x2iJwRWxsNWZo0hiLp3oKxL+smbwMKj3xOseviAzoms=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=cm6w2Vkgwa6C6VFPcS5n7ghuj6S0F2SG01gFw/0eROrsBejbSW8GizVCkoY6qZDaQ qHqzY4K3eNx8IFJSQ+1G8Yi3HoEKLyD2qTKIEkid7DXCNHQMIWKr3kEme6nOohpumH a7k7zaxJUw7tQAmYXtJFWJsSVHcoKbzrZO3AkA7AnxLojm2GfS3bRpVfyJj2MSB3eA WWJyacKDXfRYzT+56QnKqQSXq4HViQX9cXZ7/+E09yzSkGVpfneo1krdTEf/PMO+zb tFOPfaoohPb17JsRvg8XLZS2GiUSlUrJ012SuYtsWCJdufuNEr99vDD72t2Xt2kxA7 tFAt4TaHnjbCg== 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 7ECF8D6AAF9; Thu, 2 Apr 2026 18:53:41 +0000 (UTC) From: Kairui Song via B4 Relay Date: Fri, 03 Apr 2026 02:53:32 +0800 Subject: [PATCH v3 06/14] 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: <20260403-mglru-reclaim-v3-6-a285efd6ff91@tencent.com> References: <20260403-mglru-reclaim-v3-0-a285efd6ff91@tencent.com> In-Reply-To: <20260403-mglru-reclaim-v3-0-a285efd6ff91@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.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775156018; l=994; i=kasong@tencent.com; s=kasong-sign-tencent; h=from:subject:message-id; bh=QDWywh4OipGEfwenRADOn5rGg3c0b7fQ30+q0TRFWgY=; b=mZJyHWd8S2PbDZMX7PzME79oAFtxlbgMKsejQcQCfPstJyIfIcrT1wcurlc9jyTtCfzVeYrht Mb68Bn3exRTB6hO4s+5WGWGxGEfgELP3IjZa3HSB+PX+CC7TnGDarI5 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 Reviewed-by: Baolin Wang Signed-off-by: Kairui Song --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 643f9fc10214..9c28afb0219c 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5008,7 +5008,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