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.c55
1 files changed, 4 insertions, 51 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3fbe73a6fe4b..a2214c64ed3c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3137,54 +3137,6 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
3137 return NULL; 3137 return NULL;
3138} 3138}
3139 3139
3140static inline bool
3141should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
3142 enum compact_result compact_result,
3143 enum compact_priority *compact_priority,
3144 int compaction_retries)
3145{
3146 int max_retries = MAX_COMPACT_RETRIES;
3147
3148 if (!order)
3149 return false;
3150
3151 /*
3152 * compaction considers all the zone as desperately out of memory
3153 * so it doesn't really make much sense to retry except when the
3154 * failure could be caused by insufficient priority
3155 */
3156 if (compaction_failed(compact_result)) {
3157 if (*compact_priority > MIN_COMPACT_PRIORITY) {
3158 (*compact_priority)--;
3159 return true;
3160 }
3161 return false;
3162 }
3163
3164 /*
3165 * make sure the compaction wasn't deferred or didn't bail out early
3166 * due to locks contention before we declare that we should give up.
3167 * But do not retry if the given zonelist is not suitable for
3168 * compaction.
3169 */
3170 if (compaction_withdrawn(compact_result))
3171 return compaction_zonelist_suitable(ac, order, alloc_flags);
3172
3173 /*
3174 * !costly requests are much more important than __GFP_REPEAT
3175 * costly ones because they are de facto nofail and invoke OOM
3176 * killer to move on while costly can fail and users are ready
3177 * to cope with that. 1/4 retries is rather arbitrary but we
3178 * would need much more detailed feedback from compaction to
3179 * make a better decision.
3180 */
3181 if (order > PAGE_ALLOC_COSTLY_ORDER)
3182 max_retries /= 4;
3183 if (compaction_retries <= max_retries)
3184 return true;
3185
3186 return false;
3187}
3188#else 3140#else
3189static inline struct page * 3141static inline struct page *
3190__alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, 3142__alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
@@ -3195,6 +3147,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
3195 return NULL; 3147 return NULL;
3196} 3148}
3197 3149
3150#endif /* CONFIG_COMPACTION */
3151
3198static inline bool 3152static inline bool
3199should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_flags, 3153should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_flags,
3200 enum compact_result compact_result, 3154 enum compact_result compact_result,
@@ -3221,7 +3175,6 @@ should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_fla
3221 } 3175 }
3222 return false; 3176 return false;
3223} 3177}
3224#endif /* CONFIG_COMPACTION */
3225 3178
3226/* Perform direct synchronous page reclaim */ 3179/* Perform direct synchronous page reclaim */
3227static int 3180static int
@@ -4407,7 +4360,7 @@ static int build_zonelists_node(pg_data_t *pgdat, struct zonelist *zonelist,
4407 do { 4360 do {
4408 zone_type--; 4361 zone_type--;
4409 zone = pgdat->node_zones + zone_type; 4362 zone = pgdat->node_zones + zone_type;
4410 if (populated_zone(zone)) { 4363 if (managed_zone(zone)) {
4411 zoneref_set_zone(zone, 4364 zoneref_set_zone(zone,
4412 &zonelist->_zonerefs[nr_zones++]); 4365 &zonelist->_zonerefs[nr_zones++]);
4413 check_highest_zone(zone_type); 4366 check_highest_zone(zone_type);
@@ -4645,7 +4598,7 @@ static void build_zonelists_in_zone_order(pg_data_t *pgdat, int nr_nodes)
4645 for (j = 0; j < nr_nodes; j++) { 4598 for (j = 0; j < nr_nodes; j++) {
4646 node = node_order[j]; 4599 node = node_order[j];
4647 z = &NODE_DATA(node)->node_zones[zone_type]; 4600 z = &NODE_DATA(node)->node_zones[zone_type];
4648 if (populated_zone(z)) { 4601 if (managed_zone(z)) {
4649 zoneref_set_zone(z, 4602 zoneref_set_zone(z,
4650 &zonelist->_zonerefs[pos++]); 4603 &zonelist->_zonerefs[pos++]);
4651 check_highest_zone(zone_type); 4604 check_highest_zone(zone_type);