From nobody Thu Apr 2 14:13:11 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 E0EA134028F 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=1774727552; cv=none; b=Zc0kZxjlQ6VACPDuYFWZXpHiP21ESeqZ6vjkpv6dTpIKH0czXLZZCYNNzWNW7nX4veGoU4STsDILVopwycw84zJDigSp2muet8CDbDiwm5VIutExcykIUs/R1DWE9yCKX7+nvyfW8/XQQKGPBGRYuOVKVYb/WIHYjz0HlH54dTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774727552; c=relaxed/simple; bh=IwhdDUeDoXiHUP+X3n17xP8ze8d44nHV7UUvvAvMpxw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UwBl2Agl+GrQl61KBkZokrR1oqXLAIXrx5AuJNgrNA29iRhm1dmv7umfE4vwFf7fqh1ponJmXir2QcK1mbBc2147C8wZ74twk7zCHknmHvYZhsJPdv2AA5aonhJKW1jzZWISCi8fefieAnbxBqu4FAa3qOgkbid7beOUz0eXZxA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YS40uPFA; 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="YS40uPFA" Received: by smtp.kernel.org (Postfix) with ESMTPS id BD3C3C2BCB0; 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=IwhdDUeDoXiHUP+X3n17xP8ze8d44nHV7UUvvAvMpxw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=YS40uPFAU79qQQ9M5w9pAuFc3tpBNWYbUrmd0tg3GBQ3NImITQ6FBUd6ImKngQemS 7fwCvgWYzt2F/DrpDf9NyVttbDzQNQTZQ1jGv0N5PgKRb+VfqXgh7ujHddHYsopDRy k4x5x5YVMqoRnEJs+MF77VCX0TZvX/RXyv+DgxKu+GIpo3kV/VEr8Ee8frev9yunbP SuaTHVLavhLJ8nM6gBjRxZY7M32asDC31NQEv/LrlZgbYQdfG2p97Yu3QzSTXUZK4m M5gmIPCYg58/hHUt5nWyAJu1lrMuti0recoz7OqWFfsPiPgbWFbjIs18Mt0WYEzYBu yfYCUTb1/GMoQ== 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 B430710F3DFC; Sat, 28 Mar 2026 19:52:31 +0000 (UTC) From: Kairui Song via B4 Relay Date: Sun, 29 Mar 2026 03:52:35 +0800 Subject: [PATCH v2 09/12] mm/mglru: remove no longer used reclaim argument for folio protection 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-9-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=2572; i=kasong@tencent.com; s=kasong-sign-tencent; h=from:subject:message-id; bh=VpUQiKqa6L0u8xULiUTRcyn/TqUWANh3/7f3AE47AkY=; b=q400/17aQbvl8jZf/Gp51sktJ8SQrx2dNyisncTbri1+ECcL8rZw34QRp/+UkWaPL+IjLN9m/ nRgqEbu1/AODiG24HJLF2jv8ZoR50YVLzSb2nYc8GGGtkgQVhCb7vMF 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 Now dirty reclaim folios are handled after isolation, not before, since dirty reactivation must take the folio off LRU first, and that helps to unify the dirty handling logic. So this argument is no longer needed. Just remove it. Signed-off-by: Kairui Song --- mm/vmscan.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 17b5318fad39..07667649c5e2 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3220,7 +3220,7 @@ static int folio_update_gen(struct folio *folio, int = gen) } =20 /* protect pages accessed multiple times through file descriptors */ -static int folio_inc_gen(struct lruvec *lruvec, struct folio *folio, bool = reclaiming) +static int folio_inc_gen(struct lruvec *lruvec, struct folio *folio) { int type =3D folio_is_file_lru(folio); struct lru_gen_folio *lrugen =3D &lruvec->lrugen; @@ -3239,9 +3239,6 @@ static int folio_inc_gen(struct lruvec *lruvec, struc= t folio *folio, bool reclai =20 new_flags =3D old_flags & ~(LRU_GEN_MASK | LRU_REFS_FLAGS); new_flags |=3D (new_gen + 1UL) << LRU_GEN_PGOFF; - /* for folio_end_writeback() */ - if (reclaiming) - new_flags |=3D BIT(PG_reclaim); } while (!try_cmpxchg(&folio->flags.f, &old_flags, new_flags)); =20 lru_gen_update_size(lruvec, folio, old_gen, new_gen); @@ -3855,7 +3852,7 @@ static bool inc_min_seq(struct lruvec *lruvec, int ty= pe, int swappiness) VM_WARN_ON_ONCE_FOLIO(folio_is_file_lru(folio) !=3D type, folio); VM_WARN_ON_ONCE_FOLIO(folio_zonenum(folio) !=3D zone, folio); =20 - new_gen =3D folio_inc_gen(lruvec, folio, false); + new_gen =3D folio_inc_gen(lruvec, folio); list_move_tail(&folio->lru, &lrugen->folios[new_gen][type][zone]); =20 /* don't count the workingset being lazily promoted */ @@ -4612,7 +4609,7 @@ static bool sort_folio(struct lruvec *lruvec, struct = folio *folio, struct scan_c =20 /* protected */ if (tier > tier_idx || refs + workingset =3D=3D BIT(LRU_REFS_WIDTH) + 1) { - gen =3D folio_inc_gen(lruvec, folio, false); + gen =3D folio_inc_gen(lruvec, folio); list_move(&folio->lru, &lrugen->folios[gen][type][zone]); =20 /* don't count the workingset being lazily promoted */ @@ -4627,7 +4624,7 @@ static bool sort_folio(struct lruvec *lruvec, struct = folio *folio, struct scan_c =20 /* ineligible */ if (zone > sc->reclaim_idx) { - gen =3D folio_inc_gen(lruvec, folio, false); + gen =3D folio_inc_gen(lruvec, folio); list_move_tail(&folio->lru, &lrugen->folios[gen][type][zone]); return true; } --=20 2.53.0