From nobody Sat Feb 7 16:39:26 2026 Received: from mta22.hihonor.com (mta22.honor.com [81.70.192.198]) (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 CE0971993BC for ; Thu, 15 Aug 2024 12:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.70.192.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723726363; cv=none; b=bZEwkoCGobVp08yJKu12R711jLGmkgDXwZATY/tiJj7vefBiKkee6BD2DlZ2a8wsLNrG/wwmPJtoarUKy2kzVh2J7GUMdhpLwjuMeBAug73ANGvi3VjVuzTbmBF3MPckV9HfojIliK5cz38If7v9WLkevGtplZDnFBh07KQMC/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723726363; c=relaxed/simple; bh=wzIkoAnvjNhC8IujAHq4bsBjuM4OFfBPrl1PuZoYHYI=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=l9VwhltdDNT9chAZPRAjkYl/IMHsuoZkEruKHmgkM/W7FUoza2pVGiYB+A2KOFumGxX/iPsviWnWvceHIU5nlUbRhAuSDCUjk6hC13zBNiBYKATkoL2knE+N7gqUKnfdulJYh2XME/MqIEIqb4IxJZutRdBLmM0NF5WCtLoEp74= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=honor.com; spf=pass smtp.mailfrom=honor.com; arc=none smtp.client-ip=81.70.192.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=honor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=honor.com Received: from w011.hihonor.com (unknown [10.68.20.122]) by mta22.hihonor.com (SkyGuard) with ESMTPS id 4Wl4Gh0MjTzYkxh6; Thu, 15 Aug 2024 20:30:52 +0800 (CST) Received: from a018.hihonor.com (10.68.17.250) by w011.hihonor.com (10.68.20.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 15 Aug 2024 20:33:10 +0800 Received: from a007.hihonor.com (10.68.22.31) by a018.hihonor.com (10.68.17.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 15 Aug 2024 20:33:10 +0800 Received: from a007.hihonor.com ([fe80::4407:dd67:71d7:ea82]) by a007.hihonor.com ([fe80::4407:dd67:71d7:ea82%10]) with mapi id 15.02.1544.011; Thu, 15 Aug 2024 20:33:09 +0800 From: gaoxu To: Andrew Morton CC: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Suren Baghdasaryan , "Yu Zhao" , Shaohua Li , yipengxiang , fengbaopeng Subject: [PATCH] mm: add lazyfree folio to lru tail Thread-Topic: [PATCH] mm: add lazyfree folio to lru tail Thread-Index: AdrvDo5mhFpHwjY+TGSie/L6+cGQzQ== Date: Thu, 15 Aug 2024 12:33:09 +0000 Message-ID: <37bbf461e81342a7b5798923b783e349@honor.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace lruvec_add_folio with lruvec_add_folio_tail in the lru_lazyfree_fn: 1. The lazy-free folio is added to the LRU_INACTIVE_FILE list. If it's moved to the LRU tail, it allows for faster release lazy-free folio and reduces the impact on file refault. 2. When mglru is enabled, the lazy-free folio is reclaimabled and should be added using lru_gen_add_folio(lruvec, folio, true) instead of lru_gen_add_folio(lruvec, folio, false) for adding to gen. With the change in place, workingset_refault_file is reduced by 33% in the continuous startup testing of the applications in the Android system. Signed-off-by: gao xu --- mm/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swap.c b/mm/swap.c index 67786cb77..ed49643ec 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -635,7 +635,7 @@ static void lru_lazyfree_fn(struct lruvec *lruvec, stru= ct folio *folio) * anonymous folios */ folio_clear_swapbacked(folio); - lruvec_add_folio(lruvec, folio); + lruvec_add_folio_tail(lruvec, folio); =20 __count_vm_events(PGLAZYFREE, nr_pages); __count_memcg_events(lruvec_memcg(lruvec), PGLAZYFREE, --=20 2.17.1