|
@@ -1628,6 +1628,7 @@ static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark,
|
|
|
long min = mark;
|
|
|
long lowmem_reserve = z->lowmem_reserve[classzone_idx];
|
|
|
int o;
|
|
|
+ long free_cma = 0;
|
|
|
|
|
|
free_pages -= (1 << order) - 1;
|
|
|
if (alloc_flags & ALLOC_HIGH)
|
|
@@ -1637,9 +1638,10 @@ static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark,
|
|
|
#ifdef CONFIG_CMA
|
|
|
/* If allocation can't use CMA areas don't use free CMA pages */
|
|
|
if (!(alloc_flags & ALLOC_CMA))
|
|
|
- free_pages -= zone_page_state(z, NR_FREE_CMA_PAGES);
|
|
|
+ free_cma = zone_page_state(z, NR_FREE_CMA_PAGES);
|
|
|
#endif
|
|
|
- if (free_pages <= min + lowmem_reserve)
|
|
|
+
|
|
|
+ if (free_pages - free_cma <= min + lowmem_reserve)
|
|
|
return false;
|
|
|
for (o = 0; o < order; o++) {
|
|
|
/* At the next order, this order's pages become unavailable */
|