mm: fix the use of ALLOC_CMA
Movable allocations are allowed to allocate from CMA areas only when __GFP_CMA is set in the gfp mask of the request. But ALLOC_CMA is set in alloc_flags for all movable requests. This can make zone_watermark_ok take incorrect decision. Fix this by adding ALLOC_CMA only when request is of type __GFP_CMA. Change-Id: I15531968021c71cfbedd01d12307a203f0b408ca Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
This commit is contained in:
parent
f66ac54ef3
commit
c609d5c075
1 changed files with 4 additions and 2 deletions
|
@ -3988,7 +3988,8 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
|
|||
alloc_flags |= ALLOC_HARDER;
|
||||
|
||||
#ifdef CONFIG_CMA
|
||||
if (gfpflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE)
|
||||
if ((gfpflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE) &&
|
||||
(gfp_mask & __GFP_CMA))
|
||||
alloc_flags |= ALLOC_CMA;
|
||||
#endif
|
||||
return alloc_flags;
|
||||
|
@ -4448,7 +4449,8 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
|
|||
if (should_fail_alloc_page(gfp_mask, order))
|
||||
return false;
|
||||
|
||||
if (IS_ENABLED(CONFIG_CMA) && ac->migratetype == MIGRATE_MOVABLE)
|
||||
if (IS_ENABLED(CONFIG_CMA) && ac->migratetype == MIGRATE_MOVABLE &&
|
||||
(gfp_mask & __GFP_CMA))
|
||||
*alloc_flags |= ALLOC_CMA;
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue