From nobody Sat Feb 7 14:16:35 2026 Received: from mta20.hihonor.com (mta20.honor.com [81.70.206.69]) (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 7B12E54645 for ; Fri, 16 Aug 2024 08:03:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.70.206.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723795399; cv=none; b=FgjneIAl9Sb8+sM+hE+gRbrPZqp1obUKCiGZt9i9QZkYT/dkF/FrXufMt6yAkTkRp/2LScAmiORZuNUIciGnFKujE26qnNGO1Zs4vdFGAFVeLBNEMy5kFIjzR3DfX9WyM24QLTyVsvVrcZ+2EXxxd4SHL7lkwMnlQwLvQgUR9vU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723795399; c=relaxed/simple; bh=g4mcBYcFzhVMu5gQ+5WbNAYNu5fDd7oX3yiksydV/lw=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=JMI/5uUa5OCuF4XKogkHypqUfoJ8qNL+fyBOfFmAUNqFdw8pVQfAIkcnbht2COuGmELZhOGuUvag7JjqO6o8CmyUBtJ5FxxlMFX3TWg/wM5k4edwg/CIvFYHTZTHsafz/Xd5ncLTFdNAxZdI6mxIB57oNUTs5W47t/7/fbJHufU= 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.206.69 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 mta20.hihonor.com (SkyGuard) with ESMTPS id 4WlYwn1NRmzYnC3q; Fri, 16 Aug 2024 15:47:05 +0800 (CST) Received: from a016.hihonor.com (10.68.16.211) 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; Fri, 16 Aug 2024 15:48:02 +0800 Received: from a007.hihonor.com (10.68.22.31) by a016.hihonor.com (10.68.16.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 16 Aug 2024 15:48:01 +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; Fri, 16 Aug 2024 15:48:01 +0800 From: gaoxu To: Andrew Morton CC: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Suren Baghdasaryan , Shaohua Li , yipengxiang , fengbaopeng , Kalesh Singh Subject: [PATCH v2] mm: add lazyfree folio to lru tail Thread-Topic: [PATCH v2] mm: add lazyfree folio to lru tail Thread-Index: Adrvp/sHXyayf1r5TQG6pnGY8/qB0A== Date: Fri, 16 Aug 2024 07:48:01 +0000 Message-ID: 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 --- V1 -> V2: Based on the latest mm-unstable, recreate the patch. mm/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swap.c b/mm/swap.c index 6b838986d..e0dbfc983 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -641,7 +641,7 @@ static void lru_lazyfree(struct lruvec *lruvec, struct = 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, nr_pages); --=20 2.17.1