]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] fix reclaim for higher-order allocations
authorAndrew Morton <akpm@digeo.com>
Sat, 5 Oct 2002 03:35:13 +0000 (20:35 -0700)
committerRussell King <rmk@flint.arm.linux.org.uk>
Sat, 5 Oct 2002 03:35:13 +0000 (20:35 -0700)
The page reclaim logic will bail out if all zones are at pages_high.
But if the caller is requesting a higher-order allocation we need to go
on and free more memory anyway.  That's the only way we have of
addressing buddy fragmentation.

mm/vmscan.c

index e97711f8127d0f11edc31ec0fc84442883e27e97..486f04e6b5a122a814893fb3292fd08eb8fd3467 100644 (file)
@@ -602,8 +602,8 @@ static void shrink_slab(int total_scanned, int gfp_mask)
  * request.
  */
 static int
-shrink_caches(struct zone *classzone, int priority,
-               int *total_scanned, int gfp_mask, const int nr_pages)
+shrink_caches(struct zone *classzone, int priority, int *total_scanned,
+               int gfp_mask, const int nr_pages, int order)
 {
        struct zone *first_classzone;
        struct zone *zone;
@@ -616,7 +616,7 @@ shrink_caches(struct zone *classzone, int priority,
                int to_reclaim;
 
                to_reclaim = zone->pages_high - zone->free_pages;
-               if (to_reclaim < 0)
+               if (order == 0 && to_reclaim < 0)
                        continue;       /* zone has enough memory */
 
                to_reclaim = min(to_reclaim, SWAP_CLUSTER_MAX);
@@ -670,7 +670,8 @@ try_to_free_pages(struct zone *classzone,
                int total_scanned = 0;
 
                nr_reclaimed += shrink_caches(classzone, priority,
-                                       &total_scanned, gfp_mask, nr_pages);
+                                       &total_scanned, gfp_mask,
+                                       nr_pages, order);
                if (nr_reclaimed >= nr_pages)
                        return 1;
                if (total_scanned == 0)