aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorRik van Riel <riel@redhat.com>2012-03-21 19:33:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 20:54:56 -0400
commit7be62de99adcab4449d416977b4274985c5fe023 (patch)
tree20ae021ec9811ad730e6a17a3530d3aa6b5027d0 /mm/vmscan.c
parentfe2c2a106663130a5ab45cb0e3414b52df2fff0c (diff)
vmscan: kswapd carefully call compaction
With CONFIG_COMPACTION enabled, kswapd does not try to free contiguous free pages, even when it is woken for a higher order request. This could be bad for eg. jumbo frame network allocations, which are done from interrupt context and cannot compact memory themselves. Higher than before allocation failure rates in the network receive path have been observed in kernels with compaction enabled. Teach kswapd to defragment the memory zones in a node, but only if required and compaction is not deferred in a zone. [akpm@linux-foundation.org: reduce scope of zones_need_compaction] Signed-off-by: Rik van Riel <riel@redhat.com> Acked-by: Mel Gorman <mel@csn.ul.ie> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Hillf Danton <dhillf@gmail.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.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index d7dad2a4e69c..b2b4c4a0ada2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2919,6 +2919,8 @@ out:
2919 * and it is potentially going to sleep here. 2919 * and it is potentially going to sleep here.
2920 */ 2920 */
2921 if (order) { 2921 if (order) {
2922 int zones_need_compaction = 1;
2923
2922 for (i = 0; i <= end_zone; i++) { 2924 for (i = 0; i <= end_zone; i++) {
2923 struct zone *zone = pgdat->node_zones + i; 2925 struct zone *zone = pgdat->node_zones + i;
2924 2926
@@ -2939,9 +2941,17 @@ out:
2939 goto loop_again; 2941 goto loop_again;
2940 } 2942 }
2941 2943
2944 /* Check if the memory needs to be defragmented. */
2945 if (zone_watermark_ok(zone, order,
2946 low_wmark_pages(zone), *classzone_idx, 0))
2947 zones_need_compaction = 0;
2948
2942 /* If balanced, clear the congested flag */ 2949 /* If balanced, clear the congested flag */
2943 zone_clear_flag(zone, ZONE_CONGESTED); 2950 zone_clear_flag(zone, ZONE_CONGESTED);
2944 } 2951 }
2952
2953 if (zones_need_compaction)
2954 compact_pgdat(pgdat, order);
2945 } 2955 }
2946 2956
2947 /* 2957 /*