diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6407cbfccd77..2f457a756d46 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1462,15 +1462,33 @@ zonelist_scan: | |||
1462 | BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); | 1462 | BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); |
1463 | if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { | 1463 | if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { |
1464 | unsigned long mark; | 1464 | unsigned long mark; |
1465 | int ret; | ||
1466 | |||
1465 | mark = zone->watermark[alloc_flags & ALLOC_WMARK_MASK]; | 1467 | mark = zone->watermark[alloc_flags & ALLOC_WMARK_MASK]; |
1466 | if (!zone_watermark_ok(zone, order, mark, | 1468 | if (zone_watermark_ok(zone, order, mark, |
1467 | classzone_idx, alloc_flags)) { | 1469 | classzone_idx, alloc_flags)) |
1468 | if (!zone_reclaim_mode || | 1470 | goto try_this_zone; |
1469 | !zone_reclaim(zone, gfp_mask, order)) | 1471 | |
1472 | if (zone_reclaim_mode == 0) | ||
1473 | goto this_zone_full; | ||
1474 | |||
1475 | ret = zone_reclaim(zone, gfp_mask, order); | ||
1476 | switch (ret) { | ||
1477 | case ZONE_RECLAIM_NOSCAN: | ||
1478 | /* did not scan */ | ||
1479 | goto try_next_zone; | ||
1480 | case ZONE_RECLAIM_FULL: | ||
1481 | /* scanned but unreclaimable */ | ||
1482 | goto this_zone_full; | ||
1483 | default: | ||
1484 | /* did we reclaim enough */ | ||
1485 | if (!zone_watermark_ok(zone, order, mark, | ||
1486 | classzone_idx, alloc_flags)) | ||
1470 | goto this_zone_full; | 1487 | goto this_zone_full; |
1471 | } | 1488 | } |
1472 | } | 1489 | } |
1473 | 1490 | ||
1491 | try_this_zone: | ||
1474 | page = buffered_rmqueue(preferred_zone, zone, order, | 1492 | page = buffered_rmqueue(preferred_zone, zone, order, |
1475 | gfp_mask, migratetype); | 1493 | gfp_mask, migratetype); |
1476 | if (page) | 1494 | if (page) |