|
@@ -3197,6 +3197,9 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
|
|
|
{
|
|
|
int max_retries = MAX_COMPACT_RETRIES;
|
|
|
int min_priority;
|
|
|
+ bool ret = false;
|
|
|
+ int retries = *compaction_retries;
|
|
|
+ enum compact_priority priority = *compact_priority;
|
|
|
|
|
|
if (!order)
|
|
|
return false;
|
|
@@ -3218,8 +3221,10 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
|
|
|
* But do not retry if the given zonelist is not suitable for
|
|
|
* compaction.
|
|
|
*/
|
|
|
- if (compaction_withdrawn(compact_result))
|
|
|
- return compaction_zonelist_suitable(ac, order, alloc_flags);
|
|
|
+ if (compaction_withdrawn(compact_result)) {
|
|
|
+ ret = compaction_zonelist_suitable(ac, order, alloc_flags);
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
|
* !costly requests are much more important than __GFP_REPEAT
|
|
@@ -3231,8 +3236,10 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
|
|
|
*/
|
|
|
if (order > PAGE_ALLOC_COSTLY_ORDER)
|
|
|
max_retries /= 4;
|
|
|
- if (*compaction_retries <= max_retries)
|
|
|
- return true;
|
|
|
+ if (*compaction_retries <= max_retries) {
|
|
|
+ ret = true;
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
|
* Make sure there are attempts at the highest priority if we exhausted
|
|
@@ -3241,12 +3248,15 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
|
|
|
check_priority:
|
|
|
min_priority = (order > PAGE_ALLOC_COSTLY_ORDER) ?
|
|
|
MIN_COMPACT_COSTLY_PRIORITY : MIN_COMPACT_PRIORITY;
|
|
|
+
|
|
|
if (*compact_priority > min_priority) {
|
|
|
(*compact_priority)--;
|
|
|
*compaction_retries = 0;
|
|
|
- return true;
|
|
|
+ ret = true;
|
|
|
}
|
|
|
- return false;
|
|
|
+out:
|
|
|
+ trace_compact_retry(order, priority, compact_result, retries, max_retries, ret);
|
|
|
+ return ret;
|
|
|
}
|
|
|
#else
|
|
|
static inline struct page *
|