linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vm_swappiness=0 should still try to avoid swapping anon memory
@ 2021-08-06 23:17 Nico Pache
  2021-08-07  1:00 ` Shakeel Butt
  0 siblings, 1 reply; 6+ messages in thread
From: Nico Pache @ 2021-08-06 23:17 UTC (permalink / raw)
  To: linux-mm, akpm, linux-kernel; +Cc: hannes, npache, aquini

Since commit b91ac374346b ("mm: vmscan: enforce inactive:active ratio at the
reclaim root") swappiness can start prematurely swapping anon memory.
This is due to the assumption that refaulting anon should always allow
the shrinker to target anon memory. Add a check for vm_swappiness being
>0 before indiscriminately targeting Anon.

Signed-off-by: Nico Pache <npache@redhat.com>
---
 mm/vmscan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4620df62f0ff..8b932ff72e37 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2909,8 +2909,8 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc)
 
 		refaults = lruvec_page_state(target_lruvec,
 				WORKINGSET_ACTIVATE_ANON);
-		if (refaults != target_lruvec->refaults[0] ||
-			inactive_is_low(target_lruvec, LRU_INACTIVE_ANON))
+		if (vm_swappiness && (refaults != target_lruvec->refaults[0] ||
+			inactive_is_low(target_lruvec, LRU_INACTIVE_ANON)))
 			sc->may_deactivate |= DEACTIVATE_ANON;
 		else
 			sc->may_deactivate &= ~DEACTIVATE_ANON;
-- 
2.31.1



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

end of thread, other threads:[~2021-08-09 22:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 23:17 [PATCH] vm_swappiness=0 should still try to avoid swapping anon memory Nico Pache
2021-08-07  1:00 ` Shakeel Butt
2021-08-07  1:37   ` Nico Pache
2021-08-07  5:23     ` Shakeel Butt
2021-08-09 11:49       ` Michal Hocko
2021-08-09 22:31       ` Nico Pache

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