summaryrefslogtreecommitdiffstats
path: root/include/trace
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 /include/trace
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 'include/trace')
-rw-r--r--include/trace/events/mmflags.h26
-rw-r--r--include/trace/events/oom.h39
2 files changed, 65 insertions, 0 deletions
diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h
index 75ed3220ede2..91554faed17e 100644
--- a/include/trace/events/mmflags.h
+++ b/include/trace/events/mmflags.h
@@ -186,8 +186,32 @@ IF_HAVE_VM_SOFTDIRTY(VM_SOFTDIRTY, "softdirty" ) \
186 EM( COMPACT_NO_SUITABLE_PAGE, "no_suitable_page") \ 186 EM( COMPACT_NO_SUITABLE_PAGE, "no_suitable_page") \
187 EM( COMPACT_NOT_SUITABLE_ZONE, "not_suitable_zone") \ 187 EM( COMPACT_NOT_SUITABLE_ZONE, "not_suitable_zone") \
188 EMe(COMPACT_CONTENDED, "contended") 188 EMe(COMPACT_CONTENDED, "contended")
189
190/* High-level compaction status feedback */
191#define COMPACTION_FAILED 1
192#define COMPACTION_WITHDRAWN 2
193#define COMPACTION_PROGRESS 3
194
195#define compact_result_to_feedback(result) \
196({ \
197 enum compact_result __result = result; \
198 (compaction_failed(__result)) ? COMPACTION_FAILED : \
199 (compaction_withdrawn(__result)) ? COMPACTION_WITHDRAWN : COMPACTION_PROGRESS; \
200})
201
202#define COMPACTION_FEEDBACK \
203 EM(COMPACTION_FAILED, "failed") \
204 EM(COMPACTION_WITHDRAWN, "withdrawn") \
205 EMe(COMPACTION_PROGRESS, "progress")
206
207#define COMPACTION_PRIORITY \
208 EM(COMPACT_PRIO_SYNC_FULL, "COMPACT_PRIO_SYNC_FULL") \
209 EM(COMPACT_PRIO_SYNC_LIGHT, "COMPACT_PRIO_SYNC_LIGHT") \
210 EMe(COMPACT_PRIO_ASYNC, "COMPACT_PRIO_ASYNC")
189#else 211#else
190#define COMPACTION_STATUS 212#define COMPACTION_STATUS
213#define COMPACTION_PRIORITY
214#define COMPACTION_FEEDBACK
191#endif 215#endif
192 216
193#ifdef CONFIG_ZONE_DMA 217#ifdef CONFIG_ZONE_DMA
@@ -225,6 +249,8 @@ IF_HAVE_VM_SOFTDIRTY(VM_SOFTDIRTY, "softdirty" ) \
225#define EMe(a, b) TRACE_DEFINE_ENUM(a); 249#define EMe(a, b) TRACE_DEFINE_ENUM(a);
226 250
227COMPACTION_STATUS 251COMPACTION_STATUS
252COMPACTION_PRIORITY
253COMPACTION_FEEDBACK
228ZONE_TYPE 254ZONE_TYPE
229 255
230/* 256/*
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
index 9160da7a26a0..38baeb27221a 100644
--- a/include/trace/events/oom.h
+++ b/include/trace/events/oom.h
@@ -69,6 +69,45 @@ TRACE_EVENT(reclaim_retry_zone,
69 __entry->no_progress_loops, 69 __entry->no_progress_loops,
70 __entry->wmark_check) 70 __entry->wmark_check)
71); 71);
72
73#ifdef CONFIG_COMPACTION
74TRACE_EVENT(compact_retry,
75
76 TP_PROTO(int order,
77 enum compact_priority priority,
78 enum compact_result result,
79 int retries,
80 int max_retries,
81 bool ret),
82
83 TP_ARGS(order, priority, result, retries, max_retries, ret),
84
85 TP_STRUCT__entry(
86 __field( int, order)
87 __field( int, priority)
88 __field( int, result)
89 __field( int, retries)
90 __field( int, max_retries)
91 __field( bool, ret)
92 ),
93
94 TP_fast_assign(
95 __entry->order = order;
96 __entry->priority = priority;
97 __entry->result = compact_result_to_feedback(result);
98 __entry->retries = retries;
99 __entry->max_retries = max_retries;
100 __entry->ret = ret;
101 ),
102
103 TP_printk("order=%d priority=%s compaction_result=%s retries=%d max_retries=%d should_retry=%d",
104 __entry->order,
105 __print_symbolic(__entry->priority, COMPACTION_PRIORITY),
106 __print_symbolic(__entry->result, COMPACTION_FEEDBACK),
107 __entry->retries, __entry->max_retries,
108 __entry->ret)
109);
110#endif /* CONFIG_COMPACTION */
72#endif 111#endif
73 112
74/* This part must be outside protection */ 113/* This part must be outside protection */