[Devel] [PATCH rh7 2/2] mm/vmscan/HACK: scan only anon if global file inactive isn't low.

Andrey Ryabinin aryabinin at virtuozzo.com
Thu Nov 23 12:40:33 MSK 2017


Avoid swapping if global inactive list is big.

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/vmscan.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 524d1452deb1..798e013757f1 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2064,6 +2064,22 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
 		}
 	}
 
+	if (global_reclaim(sc)) {
+		unsigned long inactive = zone_page_state(zone, NR_INACTIVE_FILE);
+		unsigned long active = zone_page_state(zone, NR_ACTIVE_FILE);
+		unsigned long gb, inactive_ratio;
+
+		gb = (inactive + active) >> (30 - PAGE_SHIFT);
+		if (gb)
+			inactive_ratio = int_sqrt(10 * gb);
+		else
+			inactive_ratio = 1;
+		if (inactive_ratio * inactive >= active) {
+			scan_balance = SCAN_FILE;
+			goto out;
+		}
+	}
+
 	/*
 	 * There is enough inactive page cache, do not reclaim
 	 * anything from the anonymous working set right now.
-- 
2.13.6



More information about the Devel mailing list