summaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.com>2017-02-22 18:42:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 19:41:27 -0500
commit65190cff3cc108b72e42cce67ed8b73dbad6b731 (patch)
treec57be762c29b20bba680e11303c890c9b49f605b /mm/page_alloc.c
parentd379f01de09570e06d84b4b09e5f4951821a1dc8 (diff)
oom, trace: add compaction retry tracepoint
Higher order requests oom debugging is currently quite hard. We do have some compaction points which can tell us how the compaction is operating but there is no trace point to tell us about compaction retry logic. This patch adds a one which will have the following format bash-3126 [001] .... 1498.220001: compact_retry: order=9 priority=COMPACT_PRIO_SYNC_LIGHT compaction_result=withdrawn retries=0 max_retries=16 should_retry=0 we can see that the order 9 request is not retried even though we are in the highest compaction priority mode becase the last compaction attempt was withdrawn. This means that compaction_zonelist_suitable must have returned false and there is no suitable zone to compact for this request and so no need to retry further. another example would be <...>-3137 [001] .... 81.501689: compact_retry: order=9 priority=COMPACT_PRIO_SYNC_LIGHT compaction_result=failed retries=0 max_retries=16 should_retry=0 in this case the order-9 compaction failed to find any suitable block. We do not retry anymore because this is a costly request and those do not go below COMPACT_PRIO_SYNC_LIGHT priority. Link: http://lkml.kernel.org/r/20161220130135.15719-4-mhocko@kernel.org Signed-off-by: Michal Hocko <mhocko@suse.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: David Rientjes <rientjes@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d20f8c3139bb..05c0a59323bd 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3197,6 +3197,9 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
3197{ 3197{
3198 int max_retries = MAX_COMPACT_RETRIES; 3198 int max_retries = MAX_COMPACT_RETRIES;
3199 int min_priority; 3199 int min_priority;
3200 bool ret = false;
3201 int retries = *compaction_retries;
3202 enum compact_priority priority = *compact_priority;
3200 3203
3201 if (!order) 3204 if (!order)
3202 return false; 3205 return false;
@@ -3218,8 +3221,10 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
3218 * But do not retry if the given zonelist is not suitable for 3221 * But do not retry if the given zonelist is not suitable for
3219 * compaction. 3222 * compaction.
3220 */ 3223 */
3221 if (compaction_withdrawn(compact_result)) 3224 if (compaction_withdrawn(compact_result)) {
3222 return compaction_zonelist_suitable(ac, order, alloc_flags); 3225 ret = compaction_zonelist_suitable(ac, order, alloc_flags);
3226 goto out;
3227 }
3223 3228
3224 /* 3229 /*
3225 * !costly requests are much more important than __GFP_REPEAT 3230 * !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,
3231 */ 3236 */
3232 if (order > PAGE_ALLOC_COSTLY_ORDER) 3237 if (order > PAGE_ALLOC_COSTLY_ORDER)
3233 max_retries /= 4; 3238 max_retries /= 4;
3234 if (*compaction_retries <= max_retries) 3239 if (*compaction_retries <= max_retries) {
3235 return true; 3240 ret = true;
3241 goto out;
3242 }
3236 3243
3237 /* 3244 /*
3238 * Make sure there are attempts at the highest priority if we exhausted 3245 * 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,
3241check_priority: 3248check_priority:
3242 min_priority = (order > PAGE_ALLOC_COSTLY_ORDER) ? 3249 min_priority = (order > PAGE_ALLOC_COSTLY_ORDER) ?
3243 MIN_COMPACT_COSTLY_PRIORITY : MIN_COMPACT_PRIORITY; 3250 MIN_COMPACT_COSTLY_PRIORITY : MIN_COMPACT_PRIORITY;
3251
3244 if (*compact_priority > min_priority) { 3252 if (*compact_priority > min_priority) {
3245 (*compact_priority)--; 3253 (*compact_priority)--;
3246 *compaction_retries = 0; 3254 *compaction_retries = 0;
3247 return true; 3255 ret = true;
3248 } 3256 }
3249 return false; 3257out:
3258 trace_compact_retry(order, priority, compact_result, retries, max_retries, ret);
3259 return ret;
3250} 3260}
3251#else 3261#else
3252static inline struct page * 3262static inline struct page *