Commit 3209a954 authored by Andrew Morton's avatar Andrew Morton Committed by Russell King

[PATCH] fix reclaim for higher-order allocations

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.
parent bf3f607a
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment