diff options
| author | fire855 <thefire855@gmail.com> | 2018-03-06 22:47:10 +0100 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2018-11-30 14:44:18 +0100 |
| commit | 2e7045e4e568b4ef4d8e6751409f402a08d09528 (patch) | |
| tree | f9d62f583c594eb9e75a96b91f5db55265740cfe /mm/page_alloc.c | |
| parent | 55bb226d3043c010e0c1d6e95e09c634053f9248 (diff) | |
mm: add CMA page allocation
needed for new ion driver
Diffstat (limited to 'mm/page_alloc.c')
| -rw-r--r-- | mm/page_alloc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1139bde1d..7c8b32ab5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3090,6 +3090,26 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, if (!memcg_kmem_newpage_charge(gfp_mask, &memcg, order)) return NULL; + /* + * add special case when gfp_mask only have __GFP_HIGHMEM + __GFP_CMA, + * reassign high_zoneidx to select zone_movable as first choice + */ + if ((gfp_mask & (GFP_ZONEMASK|__GFP_CMA)) == (__GFP_HIGHMEM | __GFP_CMA)) { + gfp_mask |= __GFP_MOVABLE; + high_zoneidx = gfp_zone(gfp_mask); + migratetype = allocflags_to_migratetype(gfp_mask); + } + + if (IS_ENABLED(CONFIG_CMA) && migratetype == MIGRATE_MOVABLE) { + if (gfp_mask & __GFP_CMA) { + /* Assign high watermakr for __GFP_CMA page allocation */ + + alloc_flags &= ~ALLOC_WMARK_MASK; + alloc_flags |= ALLOC_WMARK_HIGH; + } + alloc_flags |= ALLOC_CMA; + } + retry_cpuset: cpuset_mems_cookie = get_mems_allowed(); |
