diff --git a/mm/compaction.c b/mm/compaction.c index b0b52562a46d6b89903efdaaaaa8c101eb74447d..e36b3e3f7b3043e1c23597d192ce74663e95b0ff 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2166,6 +2166,7 @@ static enum compact_result __compaction_suitable(struct zone *zone, int order, unsigned long wmark_target) { unsigned long watermark; + bool nocma; if (is_via_compact_memory(order)) return COMPACT_CONTINUE; @@ -2196,8 +2197,9 @@ static enum compact_result __compaction_suitable(struct zone *zone, int order, watermark = (order > PAGE_ALLOC_COSTLY_ORDER) ? low_wmark_pages(zone) : min_wmark_pages(zone); watermark += compact_gap(order); + nocma = !!(current->flags & PF_MEMALLOC_NOCMA); if (!__zone_watermark_ok(zone, 0, watermark, highest_zoneidx, - ALLOC_CMA, wmark_target)) + nocma ? 0 : ALLOC_CMA, wmark_target)) return COMPACT_SKIPPED; return COMPACT_CONTINUE; diff --git a/mm/page_alloc.c b/mm/page_alloc.c index becfc32f524371881b34670cf7100b9323d0e2f3..5720d9671e4a64fa9f9dd096f92f87e8734ea2ec 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3528,6 +3528,7 @@ int __isolate_free_page(struct page *page, unsigned int order) unsigned long watermark; struct zone *zone; int mt; + bool nocma; BUG_ON(!PageBuddy(page)); @@ -3542,7 +3543,8 @@ int __isolate_free_page(struct page *page, unsigned int order) * exists. */ watermark = zone->_watermark[WMARK_MIN] + (1UL << order); - if (!zone_watermark_ok(zone, 0, watermark, 0, ALLOC_CMA)) + nocma = !!(current->flags & PF_MEMALLOC_NOCMA); + if (!zone_watermark_ok(zone, 0, watermark, 0, nocma ? 0 : ALLOC_CMA)) return 0; __mod_zone_freepage_state(zone, -(1UL << order), mt);