From nobody Wed Apr 8 06:53:28 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 96E993B27EF for ; Tue, 7 Apr 2026 12:04:51 +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=1775563491; cv=none; b=LlE6uzyY8aCrPsHXNEj2uxIM5JkXCa7wPL28SaKR5pxav2uO0gPzbAaRL2qWHv5giuGTIJFnMG88h975kvZOO0n9kfe6DovixMm/dPLJX5htp391y/WTGPL9YNrfxj7GXZzMEUrPLBg518rrm1tYXUwX5u8ML/j8kvFnuYGEgqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775563491; c=relaxed/simple; bh=ztVO6NbikqAF1UlcRZLjXHar939TgkRFnRH80QPPGLA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JrOCbvbqdNzupKiWMPXeNbt6IwfpLZ6H1zAdZt2ZmVCS/9tehOAVC1ybO9U2cNjm+9C+92O7d0O6LGSKpkjhaHXMyJtJ+AruJZMtf9CtgAFw6gBrkY3LXlRfq01phkc169EcgsDBuAoRDUD8YH3TsHgvilKftCHZeqYHCibblZ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gXZ5Jr+y; 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="gXZ5Jr+y" Received: by smtp.kernel.org (Postfix) with ESMTPS id 74B38C2BCB7; Tue, 7 Apr 2026 12:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775563491; bh=ztVO6NbikqAF1UlcRZLjXHar939TgkRFnRH80QPPGLA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=gXZ5Jr+ybcDOrxB0xUP+vcfHXd4uwEXxY6Y1hc9hpS8UWcX3umJG2ULPBWOP+MaRN NIROfoLWcC0gqT1EVQISMdIM31CBABXbhF1hpbOqGVy62/+rTZLwgGlVKH8eJdAYTD N67PBggw5z4v4irWWrZ9AyzeU7bjVrBlcqvZ57XZRjCXda3BwEjuajF+MAu9e59uCo 7YWOreC8FiIy22RIpOFDFoUbQJbGgQSs2gYYy+6UqTLb3dQ+MLZ8EhjVzGiPiLHayJ 944cvF5NlkUjPmkasPqkCXxjhB0bCAAS5HRtz8/zv83haseOCw7gYURlQRR17oFZ7D U1XNYxteHuzsw== 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 6A25CFEEF2D; Tue, 7 Apr 2026 12:04:51 +0000 (UTC) From: Kairui Song via B4 Relay Date: Tue, 07 Apr 2026 19:57:35 +0800 Subject: [PATCH v4 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: <20260407-mglru-reclaim-v4-6-98cf3dc69519@tencent.com> References: <20260407-mglru-reclaim-v4-0-98cf3dc69519@tencent.com> In-Reply-To: <20260407-mglru-reclaim-v4-0-98cf3dc69519@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=1775563488; l=994; i=kasong@tencent.com; s=kasong-sign-tencent; h=from:subject:message-id; bh=X9Gq2uPvlNZqVyS5yzKBjUAw6aqnZAcV2BEvNpvNlls=; b=lyFH3Gn5CA0OabEA/Rt9iUfEdmXNiUxSdscoLOFciogLnVjX6lMOEwOJkWYYMQK9HQ02TbJJC 3FgG3UhlKPaC3WaVymdDnSuUqsq0Xu0+p3ymA2qhmsWNPox0E5UyEGZ 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 d3fd5bb56cce..c673830f4ba8 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5003,7 +5003,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