Skip to contentSkip to conversation

5/5 VM changes: reclaim_mapped-pressure.patch

PATCH New Nikita Danilov 1 participant 1 message Jul 9, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 5/5 VM changes: reclaim_mapped-pressure.patch

Use zone->pressure (rathar than scanning priority) to determine when to start reclaiming mapped pages in refill_inactive_zone(). When using priority every call to try_to_free_pages() starts with scanning parts of active list and skipping mapped pages (because reclaim_mapped evaluates to 0 on low priorities) no matter how high memory pressure is.

mm/vmscan.c renamed from mm/vmscan.c~reclaim_mapped-pressure +6 -1
diff -puN mm/vmscan.c~reclaim_mapped-pressure mm/vmscan.c
@@ -95,6 +95,11 @@ static void zone_adj_pressure(struct zon
 	zone->pressure = expavg(zone->pressure, pass << 10, 1);
 }
 
+static int pressure_to_priority(int pressure)
+{
+	return DEF_PRIORITY - (pressure >> 10);
+}
+
 /*
  * The list of shrinker callbacks used by to apply pressure to
  * ageable caches.
@@ -685,7 +690,7 @@ refill_inactive_zone(struct zone *zone, 
 	 * `distress' is a measure of how much trouble we're having reclaiming
 	 * pages.  0 -> no problems.  100 -> great trouble.
 	 */
-	distress = 100 >> priority;
+	distress = 100 >> pressure_to_priority(zone->pressure);
 
 	/*
 	 * The point of this algorithm is to decide when to start reclaiming

_