diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2011-01-13 18:47:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:46 -0500 |
commit | 5a03b051ed87e72b959f32a86054e1142ac4cf55 (patch) | |
tree | 31f0e8efb86d48b0292f8a7ea4bd9cf7c930a0ab /mm/vmscan.c | |
parent | 878aee7d6b5504e01b9caffce080e792b6b8d090 (diff) |
thp: use compaction in kswapd for GFP_ATOMIC order > 0
This takes advantage of memory compaction to properly generate pages of
order > 0 if regular page reclaim fails and priority level becomes more
severe and we don't reach the proper watermarks.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index cfdef0bcc7ab..f5b762ae23a2 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/memcontrol.h> | 41 | #include <linux/memcontrol.h> |
42 | #include <linux/delayacct.h> | 42 | #include <linux/delayacct.h> |
43 | #include <linux/sysctl.h> | 43 | #include <linux/sysctl.h> |
44 | #include <linux/compaction.h> | ||
44 | 45 | ||
45 | #include <asm/tlbflush.h> | 46 | #include <asm/tlbflush.h> |
46 | #include <asm/div64.h> | 47 | #include <asm/div64.h> |
@@ -2382,6 +2383,7 @@ loop_again: | |||
2382 | * cause too much scanning of the lower zones. | 2383 | * cause too much scanning of the lower zones. |
2383 | */ | 2384 | */ |
2384 | for (i = 0; i <= end_zone; i++) { | 2385 | for (i = 0; i <= end_zone; i++) { |
2386 | int compaction; | ||
2385 | struct zone *zone = pgdat->node_zones + i; | 2387 | struct zone *zone = pgdat->node_zones + i; |
2386 | int nr_slab; | 2388 | int nr_slab; |
2387 | 2389 | ||
@@ -2411,9 +2413,26 @@ loop_again: | |||
2411 | lru_pages); | 2413 | lru_pages); |
2412 | sc.nr_reclaimed += reclaim_state->reclaimed_slab; | 2414 | sc.nr_reclaimed += reclaim_state->reclaimed_slab; |
2413 | total_scanned += sc.nr_scanned; | 2415 | total_scanned += sc.nr_scanned; |
2416 | |||
2417 | compaction = 0; | ||
2418 | if (order && | ||
2419 | zone_watermark_ok(zone, 0, | ||
2420 | high_wmark_pages(zone), | ||
2421 | end_zone, 0) && | ||
2422 | !zone_watermark_ok(zone, order, | ||
2423 | high_wmark_pages(zone), | ||
2424 | end_zone, 0)) { | ||
2425 | compact_zone_order(zone, | ||
2426 | order, | ||
2427 | sc.gfp_mask, false, | ||
2428 | COMPACT_MODE_KSWAPD); | ||
2429 | compaction = 1; | ||
2430 | } | ||
2431 | |||
2414 | if (zone->all_unreclaimable) | 2432 | if (zone->all_unreclaimable) |
2415 | continue; | 2433 | continue; |
2416 | if (nr_slab == 0 && !zone_reclaimable(zone)) | 2434 | if (!compaction && nr_slab == 0 && |
2435 | !zone_reclaimable(zone)) | ||
2417 | zone->all_unreclaimable = 1; | 2436 | zone->all_unreclaimable = 1; |
2418 | /* | 2437 | /* |
2419 | * If we've done a decent amount of scanning and | 2438 | * If we've done a decent amount of scanning and |
@@ -2424,15 +2443,6 @@ loop_again: | |||
2424 | total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2) | 2443 | total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2) |
2425 | sc.may_writepage = 1; | 2444 | sc.may_writepage = 1; |
2426 | 2445 | ||
2427 | /* | ||
2428 | * Compact the zone for higher orders to reduce | ||
2429 | * latencies for higher-order allocations that | ||
2430 | * would ordinarily call try_to_compact_pages() | ||
2431 | */ | ||
2432 | if (sc.order > PAGE_ALLOC_COSTLY_ORDER) | ||
2433 | compact_zone_order(zone, sc.order, sc.gfp_mask, | ||
2434 | false); | ||
2435 | |||
2436 | if (!zone_watermark_ok_safe(zone, order, | 2446 | if (!zone_watermark_ok_safe(zone, order, |
2437 | high_wmark_pages(zone), end_zone, 0)) { | 2447 | high_wmark_pages(zone), end_zone, 0)) { |
2438 | all_zones_ok = 0; | 2448 | all_zones_ok = 0; |