mm: add lazyfree folio to lru tail
PATCH 1/1 mm: add lazyfree folio to lru tail
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.
--- mm/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/swap.c +1 -1
@@ -635,7 +635,7 @@ static void lru_lazyfree_fn(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,
Signature · 1 line
2.17.1
mm/swap.c static void lru_lazyfree_fn(struct lruvec *lruvec, struct folio *folio)
Quoted 22 lines · gaoxu
Replace
lruvec_add_foliowithlruvec_add_folio_tailin thelru_lazyfree_fn:
1. The lazy-free folio is added to theLRU_INACTIVE_FILElist. 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 usinglru_gen_add_folio(lruvec, folio, true)instead oflru_gen_add_folio(lruvec, folio, false)for adding to gen.With the change in place,
workingset_refault_fileis reduced by 33% in the continuous startup testing of the applications in the Android system.Signed-off-by gao xu <[email protected]>--- mm/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/swap.c +0
-0@@ -635,7 +635,7 @@ static void lru_lazyfree_fn(struct lruvec *lruvec, struct folio *folio)
Please work against the latest mm-unstable.
mm/swap.c static void lru_lazyfree_fn(struct lruvec *lruvec, struct folio *folio) · line 641
Quoted 8 lines
mm/swap.c +1
-1* 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,
Kalesh has been working on something similar for lru_deactivate(), and he can help test and review this patch.
Quoted 19 lines · gaoxu
Quoted 17 lines
Replace
lruvec_add_foliowithlruvec_add_folio_tailin thelru_lazyfree_fn:
1. The lazy-free folio is added to theLRU_INACTIVE_FILElist. 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 usinglru_gen_add_folio(lruvec, folio, true)instead oflru_gen_add_folio(lruvec, folio, false)for adding to gen.With the change in place,
workingset_refault_fileis reduced by 33% in the continuous startup testing of the applications in the Android system.Signed-off-by gao xu <[email protected]>--- mm/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines
mm/swap.c static void lru_lazyfree_fn(struct lruvec *lruvec, struct
Quoted 5 lines
mm/swap.c +0
-0@@ -635,7 +635,7 @@ static void lru_lazyfree_fn(struct lruvec *lruvec, structfolio *folio)
Please work against the latest mm-unstable.
This was my mistake. Thank you for the reminder. I will resend the patch based on the mm-unstable branch
Quoted 13 lines
mm/swap.c static void lru_lazyfree_fn(struct lruvec *lruvec, struct folio *folio)
Quoted 9 lines
mm/swap.c +1
-1* 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,
Kalesh has been working on something similar for
lru_deactivate(), and he can help test and review this patch.