aboutsummaryrefslogtreecommitdiffstats
path: root/mm/compaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/compaction.c')
-rw-r--r--mm/compaction.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 8be430b812de..dcb058bd76c4 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -42,8 +42,6 @@ struct compact_control {
42 unsigned int order; /* order a direct compactor needs */ 42 unsigned int order; /* order a direct compactor needs */
43 int migratetype; /* MOVABLE, RECLAIMABLE etc */ 43 int migratetype; /* MOVABLE, RECLAIMABLE etc */
44 struct zone *zone; 44 struct zone *zone;
45
46 int compact_mode;
47}; 45};
48 46
49static unsigned long release_freepages(struct list_head *freelist) 47static unsigned long release_freepages(struct list_head *freelist)
@@ -397,10 +395,7 @@ static int compact_finished(struct zone *zone,
397 return COMPACT_COMPLETE; 395 return COMPACT_COMPLETE;
398 396
399 /* Compaction run is not finished if the watermark is not met */ 397 /* Compaction run is not finished if the watermark is not met */
400 if (cc->compact_mode != COMPACT_MODE_KSWAPD) 398 watermark = low_wmark_pages(zone);
401 watermark = low_wmark_pages(zone);
402 else
403 watermark = high_wmark_pages(zone);
404 watermark += (1 << cc->order); 399 watermark += (1 << cc->order);
405 400
406 if (!zone_watermark_ok(zone, cc->order, watermark, 0, 0)) 401 if (!zone_watermark_ok(zone, cc->order, watermark, 0, 0))
@@ -413,15 +408,6 @@ static int compact_finished(struct zone *zone,
413 if (cc->order == -1) 408 if (cc->order == -1)
414 return COMPACT_CONTINUE; 409 return COMPACT_CONTINUE;
415 410
416 /*
417 * Generating only one page of the right order is not enough
418 * for kswapd, we must continue until we're above the high
419 * watermark as a pool for high order GFP_ATOMIC allocations
420 * too.
421 */
422 if (cc->compact_mode == COMPACT_MODE_KSWAPD)
423 return COMPACT_CONTINUE;
424
425 /* Direct compactor: Is a suitable page free? */ 411 /* Direct compactor: Is a suitable page free? */
426 for (order = cc->order; order < MAX_ORDER; order++) { 412 for (order = cc->order; order < MAX_ORDER; order++) {
427 /* Job done if page is free of the right migratetype */ 413 /* Job done if page is free of the right migratetype */
@@ -543,8 +529,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
543 529
544unsigned long compact_zone_order(struct zone *zone, 530unsigned long compact_zone_order(struct zone *zone,
545 int order, gfp_t gfp_mask, 531 int order, gfp_t gfp_mask,
546 bool sync, 532 bool sync)
547 int compact_mode)
548{ 533{
549 struct compact_control cc = { 534 struct compact_control cc = {
550 .nr_freepages = 0, 535 .nr_freepages = 0,
@@ -553,7 +538,6 @@ unsigned long compact_zone_order(struct zone *zone,
553 .migratetype = allocflags_to_migratetype(gfp_mask), 538 .migratetype = allocflags_to_migratetype(gfp_mask),
554 .zone = zone, 539 .zone = zone,
555 .sync = sync, 540 .sync = sync,
556 .compact_mode = compact_mode,
557 }; 541 };
558 INIT_LIST_HEAD(&cc.freepages); 542 INIT_LIST_HEAD(&cc.freepages);
559 INIT_LIST_HEAD(&cc.migratepages); 543 INIT_LIST_HEAD(&cc.migratepages);
@@ -599,8 +583,7 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist,
599 nodemask) { 583 nodemask) {
600 int status; 584 int status;
601 585
602 status = compact_zone_order(zone, order, gfp_mask, sync, 586 status = compact_zone_order(zone, order, gfp_mask, sync);
603 COMPACT_MODE_DIRECT_RECLAIM);
604 rc = max(status, rc); 587 rc = max(status, rc);
605 588
606 /* If a normal allocation would succeed, stop compacting */ 589 /* If a normal allocation would succeed, stop compacting */
@@ -631,7 +614,6 @@ static int compact_node(int nid)
631 .nr_freepages = 0, 614 .nr_freepages = 0,
632 .nr_migratepages = 0, 615 .nr_migratepages = 0,
633 .order = -1, 616 .order = -1,
634 .compact_mode = COMPACT_MODE_DIRECT_RECLAIM,
635 }; 617 };
636 618
637 zone = &pgdat->node_zones[zoneid]; 619 zone = &pgdat->node_zones[zoneid];