[Devel] [PATCH] mm/vmscan: inactive_list_is_low() to work on both file and anon lru lists

Konstantin Khorenko khorenko at virtuozzo.com
Sat Mar 30 11:04:28 MSK 2019


From: Andrey Ryabinin <aryabinin at virtuozzo.com>

At the moment inactive_list_is_low() mistakenly checks FILE list
whatever (file or anon) list is asked to check.

Honor list type argument.

Fixes: 1f45c6c57160 ("mm/vmscan: active lru protection fixups.")
https://jira.sw.ru/browse/PSBM-92480

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
Acked-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 mm/vmscan.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1f5f48dd3cf1..74d3e8c61cf7 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2008,7 +2008,9 @@ static void shrink_active_list(unsigned long nr_to_scan,
 static int inactive_list_is_low(struct lruvec *lruvec, bool file,
 				struct mem_cgroup *memcg, bool actual_reclaim)
 {
+	enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE;
 	struct zone *zone = lruvec_zone(lruvec);
+	enum lru_list inactive_lru = file * LRU_FILE;
 	unsigned long inactive_ratio;
 	unsigned long inactive;
 	unsigned long active;
@@ -2022,8 +2024,8 @@ static int inactive_list_is_low(struct lruvec *lruvec, bool file,
 	if (!file && !total_swap_pages)
 		return false;
 
-	inactive = lruvec_lru_size(lruvec, LRU_INACTIVE_FILE);
-	active = lruvec_lru_size(lruvec, LRU_ACTIVE_FILE);
+	inactive = lruvec_lru_size(lruvec, inactive_lru);
+	active = lruvec_lru_size(lruvec, active_lru);
 
 	if (memcg)
 		refaults = memcg_ws_activates(memcg);
-- 
2.15.1



More information about the Devel mailing list