linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm: add lazyfree folio to lru tail
@ 2024-08-16  7:48 gaoxu
  2024-08-16 10:19 ` David Hildenbrand
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: gaoxu @ 2024-08-16  7:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Suren Baghdasaryan, Shaohua Li,
	yipengxiang, fengbaopeng, Kalesh Singh

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 <gaoxu2@hihonor.com>
---
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);
 
 	__count_vm_events(PGLAZYFREE, nr_pages);
 	__count_memcg_events(lruvec_memcg(lruvec), PGLAZYFREE, nr_pages);
-- 
2.17.1

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2024-09-10  8:52 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-16  7:48 [PATCH v2] mm: add lazyfree folio to lru tail gaoxu
2024-08-16 10:19 ` David Hildenbrand
2024-08-16 10:21   ` David Hildenbrand
2024-08-19 16:11     ` Suren Baghdasaryan
2024-08-20 10:11 ` Barry Song
2024-08-20 11:53   ` 回复: " gaoxu
2024-08-20 21:46     ` Barry Song
2024-08-21 12:46 ` Michal Hocko
2024-08-21 21:47   ` Barry Song
2024-08-23 23:39     ` Suren Baghdasaryan
2024-08-26 16:37       ` Lokesh Gidra
2024-08-26 19:54         ` Barry Song
2024-08-27  0:12           ` Lokesh Gidra
2024-08-27  2:21             ` Barry Song
2024-08-27  4:07             ` 回复: " gaoxu
2024-08-27 17:56               ` Minchan Kim
2024-08-29  3:55                 ` 回复: " gaoxu
2024-09-10  8:51                   ` Barry Song
2024-08-27  2:13         ` Hailong Liu
2024-08-27  2:18           ` Barry Song
2024-08-27  2:29             ` Hailong Liu
2024-09-09 22:22               ` Andrew Morton
2024-09-10  8:20                 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox