summaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 07f19248acb5..c66fb875104a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2102,7 +2102,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
2102 struct zonelist *zonelist, enum zone_type high_zoneidx, 2102 struct zonelist *zonelist, enum zone_type high_zoneidx,
2103 nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone, 2103 nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone,
2104 int migratetype, bool sync_migration, 2104 int migratetype, bool sync_migration,
2105 bool *deferred_compaction, 2105 bool *contended_compaction, bool *deferred_compaction,
2106 unsigned long *did_some_progress) 2106 unsigned long *did_some_progress)
2107{ 2107{
2108 struct page *page; 2108 struct page *page;
@@ -2117,7 +2117,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
2117 2117
2118 current->flags |= PF_MEMALLOC; 2118 current->flags |= PF_MEMALLOC;
2119 *did_some_progress = try_to_compact_pages(zonelist, order, gfp_mask, 2119 *did_some_progress = try_to_compact_pages(zonelist, order, gfp_mask,
2120 nodemask, sync_migration); 2120 nodemask, sync_migration,
2121 contended_compaction);
2121 current->flags &= ~PF_MEMALLOC; 2122 current->flags &= ~PF_MEMALLOC;
2122 if (*did_some_progress != COMPACT_SKIPPED) { 2123 if (*did_some_progress != COMPACT_SKIPPED) {
2123 2124
@@ -2163,7 +2164,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
2163 struct zonelist *zonelist, enum zone_type high_zoneidx, 2164 struct zonelist *zonelist, enum zone_type high_zoneidx,
2164 nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone, 2165 nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone,
2165 int migratetype, bool sync_migration, 2166 int migratetype, bool sync_migration,
2166 bool *deferred_compaction, 2167 bool *contended_compaction, bool *deferred_compaction,
2167 unsigned long *did_some_progress) 2168 unsigned long *did_some_progress)
2168{ 2169{
2169 return NULL; 2170 return NULL;
@@ -2336,6 +2337,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
2336 unsigned long did_some_progress; 2337 unsigned long did_some_progress;
2337 bool sync_migration = false; 2338 bool sync_migration = false;
2338 bool deferred_compaction = false; 2339 bool deferred_compaction = false;
2340 bool contended_compaction = false;
2339 2341
2340 /* 2342 /*
2341 * In the slowpath, we sanity check order to avoid ever trying to 2343 * In the slowpath, we sanity check order to avoid ever trying to
@@ -2425,6 +2427,7 @@ rebalance:
2425 nodemask, 2427 nodemask,
2426 alloc_flags, preferred_zone, 2428 alloc_flags, preferred_zone,
2427 migratetype, sync_migration, 2429 migratetype, sync_migration,
2430 &contended_compaction,
2428 &deferred_compaction, 2431 &deferred_compaction,
2429 &did_some_progress); 2432 &did_some_progress);
2430 if (page) 2433 if (page)
@@ -2434,10 +2437,11 @@ rebalance:
2434 /* 2437 /*
2435 * If compaction is deferred for high-order allocations, it is because 2438 * If compaction is deferred for high-order allocations, it is because
2436 * sync compaction recently failed. In this is the case and the caller 2439 * sync compaction recently failed. In this is the case and the caller
2437 * has requested the system not be heavily disrupted, fail the 2440 * requested a movable allocation that does not heavily disrupt the
2438 * allocation now instead of entering direct reclaim 2441 * system then fail the allocation instead of entering direct reclaim.
2439 */ 2442 */
2440 if (deferred_compaction && (gfp_mask & __GFP_NO_KSWAPD)) 2443 if ((deferred_compaction || contended_compaction) &&
2444 (gfp_mask & __GFP_NO_KSWAPD))
2441 goto nopage; 2445 goto nopage;
2442 2446
2443 /* Try direct reclaim and then allocating */ 2447 /* Try direct reclaim and then allocating */
@@ -2508,6 +2512,7 @@ rebalance:
2508 nodemask, 2512 nodemask,
2509 alloc_flags, preferred_zone, 2513 alloc_flags, preferred_zone,
2510 migratetype, sync_migration, 2514 migratetype, sync_migration,
2515 &contended_compaction,
2511 &deferred_compaction, 2516 &deferred_compaction,
2512 &did_some_progress); 2517 &did_some_progress);
2513 if (page) 2518 if (page)