diff mbox series

[Resend] mm: mark folio as workingset in lru_deactivate_fn

Message ID 1681980304-11719-1-git-send-email-zhaoyang.huang@unisoc.com (mailing list archive)
State New
Headers show
Series [Resend] mm: mark folio as workingset in lru_deactivate_fn | expand

Commit Message

zhaoyang.huang April 20, 2023, 8:45 a.m. UTC
From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

The folio will be set as workingset by shrink_active_pages during normal reclaiming.
However, it will be escaped from doing so when madvise move it by lru_deactivate_<file>_fn,
which will affect accuracy of thrashing.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
 mm/swap.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Matthew Wilcox April 20, 2023, 12:06 p.m. UTC | #1
On Thu, Apr 20, 2023 at 04:45:04PM +0800, zhaoyang.huang wrote:
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> 
> The folio will be set as workingset by shrink_active_pages during normal reclaiming.
> However, it will be escaped from doing so when madvise move it by lru_deactivate_<file>_fn,
> which will affect accuracy of thrashing.

Why are you resending this?  Johannes pointed out that your
understanding of this situation is wrong.  The folio is being
made _inactive_.  It's clearly no longer part of the working set!
diff mbox series

Patch

diff --git a/mm/swap.c b/mm/swap.c
index 70e2063..4d1c14f 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -603,6 +603,7 @@  static void lru_deactivate_file_fn(struct lruvec *lruvec, struct folio *folio)
 	lruvec_del_folio(lruvec, folio);
 	folio_clear_active(folio);
 	folio_clear_referenced(folio);
+	folio_set_workingset(folio);
 
 	if (folio_test_writeback(folio) || folio_test_dirty(folio)) {
 		/*
@@ -637,6 +638,7 @@  static void lru_deactivate_fn(struct lruvec *lruvec, struct folio *folio)
 		lruvec_del_folio(lruvec, folio);
 		folio_clear_active(folio);
 		folio_clear_referenced(folio);
+		folio_set_workingset(folio);
 		lruvec_add_folio(lruvec, folio);
 
 		__count_vm_events(PGDEACTIVATE, nr_pages);