aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 09ba67487897..26c6fe74f5c5 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3096,7 +3096,7 @@ out:
3096static struct page * 3096static struct page *
3097__alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, 3097__alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
3098 unsigned int alloc_flags, const struct alloc_context *ac, 3098 unsigned int alloc_flags, const struct alloc_context *ac,
3099 enum migrate_mode mode, enum compact_result *compact_result) 3099 enum compact_priority prio, enum compact_result *compact_result)
3100{ 3100{
3101 struct page *page; 3101 struct page *page;
3102 int contended_compaction; 3102 int contended_compaction;
@@ -3106,7 +3106,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
3106 3106
3107 current->flags |= PF_MEMALLOC; 3107 current->flags |= PF_MEMALLOC;
3108 *compact_result = try_to_compact_pages(gfp_mask, order, alloc_flags, ac, 3108 *compact_result = try_to_compact_pages(gfp_mask, order, alloc_flags, ac,
3109 mode, &contended_compaction); 3109 prio, &contended_compaction);
3110 current->flags &= ~PF_MEMALLOC; 3110 current->flags &= ~PF_MEMALLOC;
3111 3111
3112 if (*compact_result <= COMPACT_INACTIVE) 3112 if (*compact_result <= COMPACT_INACTIVE)
@@ -3160,7 +3160,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
3160 3160
3161static inline bool 3161static inline bool
3162should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, 3162should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
3163 enum compact_result compact_result, enum migrate_mode *migrate_mode, 3163 enum compact_result compact_result,
3164 enum compact_priority *compact_priority,
3164 int compaction_retries) 3165 int compaction_retries)
3165{ 3166{
3166 int max_retries = MAX_COMPACT_RETRIES; 3167 int max_retries = MAX_COMPACT_RETRIES;
@@ -3171,11 +3172,11 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
3171 /* 3172 /*
3172 * compaction considers all the zone as desperately out of memory 3173 * compaction considers all the zone as desperately out of memory
3173 * so it doesn't really make much sense to retry except when the 3174 * so it doesn't really make much sense to retry except when the
3174 * failure could be caused by weak migration mode. 3175 * failure could be caused by insufficient priority
3175 */ 3176 */
3176 if (compaction_failed(compact_result)) { 3177 if (compaction_failed(compact_result)) {
3177 if (*migrate_mode == MIGRATE_ASYNC) { 3178 if (*compact_priority > MIN_COMPACT_PRIORITY) {
3178 *migrate_mode = MIGRATE_SYNC_LIGHT; 3179 (*compact_priority)--;
3179 return true; 3180 return true;
3180 } 3181 }
3181 return false; 3182 return false;
@@ -3209,7 +3210,7 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
3209static inline struct page * 3210static inline struct page *
3210__alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, 3211__alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
3211 unsigned int alloc_flags, const struct alloc_context *ac, 3212 unsigned int alloc_flags, const struct alloc_context *ac,
3212 enum migrate_mode mode, enum compact_result *compact_result) 3213 enum compact_priority prio, enum compact_result *compact_result)
3213{ 3214{
3214 *compact_result = COMPACT_SKIPPED; 3215 *compact_result = COMPACT_SKIPPED;
3215 return NULL; 3216 return NULL;
@@ -3218,7 +3219,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
3218static inline bool 3219static inline bool
3219should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_flags, 3220should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_flags,
3220 enum compact_result compact_result, 3221 enum compact_result compact_result,
3221 enum migrate_mode *migrate_mode, 3222 enum compact_priority *compact_priority,
3222 int compaction_retries) 3223 int compaction_retries)
3223{ 3224{
3224 struct zone *zone; 3225 struct zone *zone;
@@ -3473,7 +3474,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
3473 struct page *page = NULL; 3474 struct page *page = NULL;
3474 unsigned int alloc_flags; 3475 unsigned int alloc_flags;
3475 unsigned long did_some_progress; 3476 unsigned long did_some_progress;
3476 enum migrate_mode migration_mode = MIGRATE_SYNC_LIGHT; 3477 enum compact_priority compact_priority = DEF_COMPACT_PRIORITY;
3477 enum compact_result compact_result; 3478 enum compact_result compact_result;
3478 int compaction_retries = 0; 3479 int compaction_retries = 0;
3479 int no_progress_loops = 0; 3480 int no_progress_loops = 0;
@@ -3525,7 +3526,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
3525 !gfp_pfmemalloc_allowed(gfp_mask)) { 3526 !gfp_pfmemalloc_allowed(gfp_mask)) {
3526 page = __alloc_pages_direct_compact(gfp_mask, order, 3527 page = __alloc_pages_direct_compact(gfp_mask, order,
3527 alloc_flags, ac, 3528 alloc_flags, ac,
3528 MIGRATE_ASYNC, 3529 INIT_COMPACT_PRIORITY,
3529 &compact_result); 3530 &compact_result);
3530 if (page) 3531 if (page)
3531 goto got_pg; 3532 goto got_pg;
@@ -3558,7 +3559,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
3558 * sync compaction could be very expensive, so keep 3559 * sync compaction could be very expensive, so keep
3559 * using async compaction. 3560 * using async compaction.
3560 */ 3561 */
3561 migration_mode = MIGRATE_ASYNC; 3562 compact_priority = INIT_COMPACT_PRIORITY;
3562 } 3563 }
3563 } 3564 }
3564 3565
@@ -3624,8 +3625,7 @@ retry:
3624 3625
3625 /* Try direct compaction and then allocating */ 3626 /* Try direct compaction and then allocating */
3626 page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac, 3627 page = __alloc_pages_direct_compact(gfp_mask, order, alloc_flags, ac,
3627 migration_mode, 3628 compact_priority, &compact_result);
3628 &compact_result);
3629 if (page) 3629 if (page)
3630 goto got_pg; 3630 goto got_pg;
3631 3631
@@ -3665,7 +3665,7 @@ retry:
3665 */ 3665 */
3666 if (did_some_progress > 0 && 3666 if (did_some_progress > 0 &&
3667 should_compact_retry(ac, order, alloc_flags, 3667 should_compact_retry(ac, order, alloc_flags,
3668 compact_result, &migration_mode, 3668 compact_result, &compact_priority,
3669 compaction_retries)) 3669 compaction_retries))
3670 goto retry; 3670 goto retry;
3671 3671