diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2014-10-09 18:26:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-09 22:25:53 -0400 |
commit | 21bb9bd19430a43e6462ce75030fd7fac4b766ef (patch) | |
tree | 006dbbeb5152c97d450197da1ac16034b3df0640 /mm/page_alloc.c | |
parent | 95b0e655f9148881907fdbe5baba6a9f5d094fee (diff) |
mm: page_alloc: determine migratetype only once
The check for ALLOC_CMA in __alloc_pages_nodemask() derives migratetype
from gfp_mask in each retry pass, although the migratetype variable
already has the value determined and it does not change. Use the variable
and perform the check only once. Also convert #ifdef CONFIG_CMA to
IS_ENABLED.
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f3bc59f2ed52..e63bf7744a0c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2776,6 +2776,9 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, | |||
2776 | if (unlikely(!zonelist->_zonerefs->zone)) | 2776 | if (unlikely(!zonelist->_zonerefs->zone)) |
2777 | return NULL; | 2777 | return NULL; |
2778 | 2778 | ||
2779 | if (IS_ENABLED(CONFIG_CMA) && migratetype == MIGRATE_MOVABLE) | ||
2780 | alloc_flags |= ALLOC_CMA; | ||
2781 | |||
2779 | retry_cpuset: | 2782 | retry_cpuset: |
2780 | cpuset_mems_cookie = read_mems_allowed_begin(); | 2783 | cpuset_mems_cookie = read_mems_allowed_begin(); |
2781 | 2784 | ||
@@ -2787,10 +2790,6 @@ retry_cpuset: | |||
2787 | goto out; | 2790 | goto out; |
2788 | classzone_idx = zonelist_zone_idx(preferred_zoneref); | 2791 | classzone_idx = zonelist_zone_idx(preferred_zoneref); |
2789 | 2792 | ||
2790 | #ifdef CONFIG_CMA | ||
2791 | if (allocflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE) | ||
2792 | alloc_flags |= ALLOC_CMA; | ||
2793 | #endif | ||
2794 | /* First allocation attempt */ | 2793 | /* First allocation attempt */ |
2795 | page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, nodemask, order, | 2794 | page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, nodemask, order, |
2796 | zonelist, high_zoneidx, alloc_flags, | 2795 | zonelist, high_zoneidx, alloc_flags, |