]> git.hungrycats.org Git - linux/commitdiff
[PATCH] shrink_all_memory() fixes
authorAndrew Morton <akpm@osdl.org>
Thu, 3 Jun 2004 00:58:03 +0000 (17:58 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 3 Jun 2004 00:58:03 +0000 (17:58 -0700)
- Off-by-one in balance_pgdat means that we're not scanning the zones all
  the way down to priority=0.

- Always set zone->temp_priority in shrink_caches().  I'm not sure why I had
  the `if (zone->free_pages < zone->pages_high)' test in there, but it's
  preventing us from setting ->prev_priority correctly on the
  try_to_free_pages() path.

- Set zone->prev_priority to the current priority if it's currently a
  "lower" priority.  This allows us to build up the pressure on mapped pages
  on the first scanning pass rather than only on successive passes.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/vmscan.c

index 2a111c86b912603449b29b1d06e2ee55ecf01d3f..f0ec7d2c67d31659b786ff0a4b83574aed03890d 100644 (file)
@@ -813,8 +813,9 @@ shrink_caches(struct zone **zones, int priority, int *total_scanned,
                struct zone *zone = zones[i];
                int max_scan;
 
-               if (zone->free_pages < zone->pages_high)
-                       zone->temp_priority = priority;
+               zone->temp_priority = priority;
+               if (zone->prev_priority > priority)
+                       zone->prev_priority = priority;
 
                if (zone->all_unreclaimable && priority != DEF_PRIORITY)
                        continue;       /* Let kswapd poll it */
@@ -945,7 +946,7 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps)
                zone->temp_priority = DEF_PRIORITY;
        }
 
-       for (priority = DEF_PRIORITY; priority; priority--) {
+       for (priority = DEF_PRIORITY; priority >= 0; priority--) {
                int all_zones_ok = 1;
                int end_zone = 0;       /* Inclusive.  0 = ZONE_DMA */
 
@@ -995,6 +996,8 @@ scan:
                                        all_zones_ok = 0;
                        }
                        zone->temp_priority = priority;
+                       if (zone->prev_priority > priority)
+                               zone->prev_priority = priority;
                        max_scan = (zone->nr_active + zone->nr_inactive)
                                                                >> priority;
                        reclaimed = shrink_zone(zone, max_scan, GFP_KERNEL,