vmscan: Do not run shrinkers for zones other than ZONE_NORMAL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Slab objects (and other caches) are always allocated from ZONE_NORMAL.
Not from any other zone. Calling the shrinkers for those zones may put
unnecessary pressure on the caches.

Check the zone if we are in a reclaim situation where we are targeting
a specific node. Can occur f.e. in kswapd and in zone reclaim.

Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>

---
 mm/vmscan.c |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

Index: linux-2.6/mm/vmscan.c
===================================================================
--- linux-2.6.orig/mm/vmscan.c	2010-10-21 12:26:17.000000000 -0500
+++ linux-2.6/mm/vmscan.c	2010-10-21 12:33:56.000000000 -0500
@@ -2218,15 +2218,21 @@ loop_again:
 			if (!zone_watermark_ok(zone, order,
 					8*high_wmark_pages(zone), end_zone, 0))
 				shrink_zone(priority, zone, &sc);
-			reclaim_state->reclaimed_slab = 0;
-			nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
-						lru_pages);
-			sc.nr_reclaimed += reclaim_state->reclaimed_slab;
-			total_scanned += sc.nr_scanned;
+
+			if (zone_idx(zone) == ZONE_NORMAL) {
+				reclaim_state->reclaimed_slab = 0;
+				nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
+							lru_pages);
+				sc.nr_reclaimed += reclaim_state->reclaimed_slab;
+				total_scanned += sc.nr_scanned;
+			} else
+				nr_slab = 0;
+
 			if (zone->all_unreclaimable)
 				continue;
 			if (nr_slab == 0 && !zone_reclaimable(zone))
 				zone->all_unreclaimable = 1;
+
 			/*
 			 * If we've done a decent amount of scanning and
 			 * the reclaim ratio is low, start doing writepage
@@ -2697,7 +2703,8 @@ static int __zone_reclaim(struct zone *z
 	}

 	nr_slab_pages0 = zone_page_state(zone, NR_SLAB_RECLAIMABLE);
-	if (nr_slab_pages0 > zone->min_slab_pages) {
+	if (nr_slab_pages0 > zone->min_slab_pages &&
+					zone_idx(zone) == ZONE_NORMAL) {
 		/*
 		 * shrink_slab() does not currently allow us to determine how
 		 * many pages were freed in this zone. So we take the current

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]