[Resend] mm: mark folio as workingset in lru_deactivate_fn
Commit Message
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
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!
@@ -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);