mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 14:43:27 -04:00
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
a96ae75ea9
commit
3f23e82084
1 changed files with 4 additions and 2 deletions
|
|
@ -4313,7 +4313,8 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
|
|||
alloc_flags |= ALLOC_KSWAPD;
|
||||
|
||||
#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;
|
||||
|
|
@ -4795,7 +4796,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