alistair23-linux/include/trace/events/oom.h
Michal Hocko 65190cff3c 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>
2017-02-22 16:41:27 -08:00

115 lines
2.9 KiB
C

#undef TRACE_SYSTEM
#define TRACE_SYSTEM oom
#if !defined(_TRACE_OOM_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_OOM_H
#include <linux/tracepoint.h>
#include <trace/events/mmflags.h>
TRACE_EVENT(oom_score_adj_update,
TP_PROTO(struct task_struct *task),
TP_ARGS(task),
TP_STRUCT__entry(
__field( pid_t, pid)
__array( char, comm, TASK_COMM_LEN )
__field( short, oom_score_adj)
),
TP_fast_assign(
__entry->pid = task->pid;
memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
__entry->oom_score_adj = task->signal->oom_score_adj;
),
TP_printk("pid=%d comm=%s oom_score_adj=%hd",
__entry->pid, __entry->comm, __entry->oom_score_adj)
);
TRACE_EVENT(reclaim_retry_zone,
TP_PROTO(struct zoneref *zoneref,
int order,
unsigned long reclaimable,
unsigned long available,
unsigned long min_wmark,
int no_progress_loops,
bool wmark_check),
TP_ARGS(zoneref, order, reclaimable, available, min_wmark, no_progress_loops, wmark_check),
TP_STRUCT__entry(
__field( int, node)
__field( int, zone_idx)
__field( int, order)
__field( unsigned long, reclaimable)
__field( unsigned long, available)
__field( unsigned long, min_wmark)
__field( int, no_progress_loops)
__field( bool, wmark_check)
),
TP_fast_assign(
__entry->node = zone_to_nid(zoneref->zone);
__entry->zone_idx = zoneref->zone_idx;
__entry->order = order;
__entry->reclaimable = reclaimable;
__entry->available = available;
__entry->min_wmark = min_wmark;
__entry->no_progress_loops = no_progress_loops;
__entry->wmark_check = wmark_check;
),
TP_printk("node=%d zone=%-8s order=%d reclaimable=%lu available=%lu min_wmark=%lu no_progress_loops=%d wmark_check=%d",
__entry->node, __print_symbolic(__entry->zone_idx, ZONE_TYPE),
__entry->order,
__entry->reclaimable, __entry->available, __entry->min_wmark,
__entry->no_progress_loops,
__entry->wmark_check)
);
#ifdef CONFIG_COMPACTION
TRACE_EVENT(compact_retry,
TP_PROTO(int order,
enum compact_priority priority,
enum compact_result result,
int retries,
int max_retries,
bool ret),
TP_ARGS(order, priority, result, retries, max_retries, ret),
TP_STRUCT__entry(
__field( int, order)
__field( int, priority)
__field( int, result)
__field( int, retries)
__field( int, max_retries)
__field( bool, ret)
),
TP_fast_assign(
__entry->order = order;
__entry->priority = priority;
__entry->result = compact_result_to_feedback(result);
__entry->retries = retries;
__entry->max_retries = max_retries;
__entry->ret = ret;
),
TP_printk("order=%d priority=%s compaction_result=%s retries=%d max_retries=%d should_retry=%d",
__entry->order,
__print_symbolic(__entry->priority, COMPACTION_PRIORITY),
__print_symbolic(__entry->result, COMPACTION_FEEDBACK),
__entry->retries, __entry->max_retries,
__entry->ret)
);
#endif /* CONFIG_COMPACTION */
#endif
/* This part must be outside protection */
#include <trace/define_trace.h>