diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a2214c64ed3c..9b3b3a79c58a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3347,17 +3347,24 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order, ac->nodemask) { unsigned long available; unsigned long reclaimable; + int check_order = order; + unsigned long watermark = min_wmark_pages(zone); available = reclaimable = zone_reclaimable_pages(zone); available -= DIV_ROUND_UP(no_progress_loops * available, MAX_RECLAIM_RETRIES); available += zone_page_state_snapshot(zone, NR_FREE_PAGES); + if (order > 0 && order <= PAGE_ALLOC_COSTLY_ORDER) { + check_order = 0; + watermark += 1UL << order; + } + /* * Would the allocation succeed if we reclaimed the whole * available? */ - if (__zone_watermark_ok(zone, order, min_wmark_pages(zone), + if (__zone_watermark_ok(zone, check_order, watermark, ac_classzone_idx(ac), alloc_flags, available)) { /* * If we didn't make any progress and have a lot of