aboutsummaryrefslogtreecommitdiffstats
path: root/mm/compaction.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2012-10-08 19:32:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:22:45 -0400
commitd95ea5d18e699515468368415c93ed49b1a3221b (patch)
tree5e4828e1ad279462c64c08dd305905e610418d90 /mm/compaction.c
parentd1ce749a0db12202b711d1aba1d29e823034648d (diff)
cma: fix watermark checking
* Add ALLOC_CMA alloc flag and pass it to [__]zone_watermark_ok() (from Minchan Kim). * During watermark check decrease available free pages number by free CMA pages number if necessary (unmovable allocations cannot use pages from CMA areas). Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Michal Nazarewicz <mina86@mina86.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Mel Gorman <mgorman@suse.de> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r--mm/compaction.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 0fbc6b73a522..1f61bcbd6262 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -934,6 +934,7 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist,
934 struct zoneref *z; 934 struct zoneref *z;
935 struct zone *zone; 935 struct zone *zone;
936 int rc = COMPACT_SKIPPED; 936 int rc = COMPACT_SKIPPED;
937 int alloc_flags = 0;
937 938
938 /* Check if the GFP flags allow compaction */ 939 /* Check if the GFP flags allow compaction */
939 if (!order || !may_enter_fs || !may_perform_io) 940 if (!order || !may_enter_fs || !may_perform_io)
@@ -941,6 +942,10 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist,
941 942
942 count_vm_event(COMPACTSTALL); 943 count_vm_event(COMPACTSTALL);
943 944
945#ifdef CONFIG_CMA
946 if (allocflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE)
947 alloc_flags |= ALLOC_CMA;
948#endif
944 /* Compact each zone in the list */ 949 /* Compact each zone in the list */
945 for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx, 950 for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx,
946 nodemask) { 951 nodemask) {
@@ -951,7 +956,8 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist,
951 rc = max(status, rc); 956 rc = max(status, rc);
952 957
953 /* If a normal allocation would succeed, stop compacting */ 958 /* If a normal allocation would succeed, stop compacting */
954 if (zone_watermark_ok(zone, order, low_wmark_pages(zone), 0, 0)) 959 if (zone_watermark_ok(zone, order, low_wmark_pages(zone), 0,
960 alloc_flags))
955 break; 961 break;
956 } 962 }
957 963