Commit 16c4a097 authored by Joonsoo Kim's avatar Joonsoo Kim Committed by Linus Torvalds

mm/compaction: enhance tracepoint output for compaction begin/end

We now have tracepoint for begin event of compaction and it prints start
position of both scanners, but, tracepoint for end event of compaction
doesn't print finish position of both scanners.  It'd be also useful to
know finish position of both scanners so this patch add it.  It will help
to find odd behavior or problem on compaction internal logic.

And mode is added to both begin/end tracepoint output, since according to
mode, compaction behavior is quite different.

And lastly, status format is changed to string rather than status number
for readability.

[akpm@linux-foundation.org: fix sparse warning]
Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4645f063
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#define COMPACT_PARTIAL 3 #define COMPACT_PARTIAL 3
/* The full zone was compacted */ /* The full zone was compacted */
#define COMPACT_COMPLETE 4 #define COMPACT_COMPLETE 4
/* When adding new state, please change compaction_status_string, too */
/* Used to signal whether compaction detected need_sched() or lock contention */ /* Used to signal whether compaction detected need_sched() or lock contention */
/* No contention detected */ /* No contention detected */
......
...@@ -85,46 +85,67 @@ TRACE_EVENT(mm_compaction_migratepages, ...@@ -85,46 +85,67 @@ TRACE_EVENT(mm_compaction_migratepages,
); );
TRACE_EVENT(mm_compaction_begin, TRACE_EVENT(mm_compaction_begin,
TP_PROTO(unsigned long zone_start, unsigned long migrate_start, TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
unsigned long free_start, unsigned long zone_end), unsigned long free_pfn, unsigned long zone_end, bool sync),
TP_ARGS(zone_start, migrate_start, free_start, zone_end), TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, zone_start) __field(unsigned long, zone_start)
__field(unsigned long, migrate_start) __field(unsigned long, migrate_pfn)
__field(unsigned long, free_start) __field(unsigned long, free_pfn)
__field(unsigned long, zone_end) __field(unsigned long, zone_end)
__field(bool, sync)
), ),
TP_fast_assign( TP_fast_assign(
__entry->zone_start = zone_start; __entry->zone_start = zone_start;
__entry->migrate_start = migrate_start; __entry->migrate_pfn = migrate_pfn;
__entry->free_start = free_start; __entry->free_pfn = free_pfn;
__entry->zone_end = zone_end; __entry->zone_end = zone_end;
__entry->sync = sync;
), ),
TP_printk("zone_start=0x%lx migrate_start=0x%lx free_start=0x%lx zone_end=0x%lx", TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s",
__entry->zone_start, __entry->zone_start,
__entry->migrate_start, __entry->migrate_pfn,
__entry->free_start, __entry->free_pfn,
__entry->zone_end) __entry->zone_end,
__entry->sync ? "sync" : "async")
); );
TRACE_EVENT(mm_compaction_end, TRACE_EVENT(mm_compaction_end,
TP_PROTO(int status), TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
unsigned long free_pfn, unsigned long zone_end, bool sync,
int status),
TP_ARGS(status), TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync, status),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, zone_start)
__field(unsigned long, migrate_pfn)
__field(unsigned long, free_pfn)
__field(unsigned long, zone_end)
__field(bool, sync)
__field(int, status) __field(int, status)
), ),
TP_fast_assign( TP_fast_assign(
__entry->zone_start = zone_start;
__entry->migrate_pfn = migrate_pfn;
__entry->free_pfn = free_pfn;
__entry->zone_end = zone_end;
__entry->sync = sync;
__entry->status = status; __entry->status = status;
), ),
TP_printk("status=%d", __entry->status) TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s",
__entry->zone_start,
__entry->migrate_pfn,
__entry->free_pfn,
__entry->zone_end,
__entry->sync ? "sync" : "async",
compaction_status_string[__entry->status])
); );
#endif /* _TRACE_COMPACTION_H */ #endif /* _TRACE_COMPACTION_H */
......
...@@ -34,6 +34,15 @@ static inline void count_compact_events(enum vm_event_item item, long delta) ...@@ -34,6 +34,15 @@ static inline void count_compact_events(enum vm_event_item item, long delta)
#endif #endif
#if defined CONFIG_COMPACTION || defined CONFIG_CMA #if defined CONFIG_COMPACTION || defined CONFIG_CMA
#ifdef CONFIG_TRACEPOINTS
static const char *const compaction_status_string[] = {
"deferred",
"skipped",
"continue",
"partial",
"complete",
};
#endif
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/compaction.h> #include <trace/events/compaction.h>
...@@ -1197,7 +1206,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) ...@@ -1197,7 +1206,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
zone->compact_cached_migrate_pfn[1] = cc->migrate_pfn; zone->compact_cached_migrate_pfn[1] = cc->migrate_pfn;
} }
trace_mm_compaction_begin(start_pfn, cc->migrate_pfn, cc->free_pfn, end_pfn); trace_mm_compaction_begin(start_pfn, cc->migrate_pfn,
cc->free_pfn, end_pfn, sync);
migrate_prep_local(); migrate_prep_local();
...@@ -1299,7 +1309,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) ...@@ -1299,7 +1309,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
zone->compact_cached_free_pfn = free_pfn; zone->compact_cached_free_pfn = free_pfn;
} }
trace_mm_compaction_end(ret); trace_mm_compaction_end(start_pfn, cc->migrate_pfn,
cc->free_pfn, end_pfn, sync, ret);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment