[PATCH 2/2] mm: compaction.c: Add/Modify direct compaction tracepoints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add zone information to an existing tracepoint in compact_zone(). Also,
add a new tracepoint at the end of the compaction code so that latency 
information can be derived.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@xxxxxxxxx>
---
 include/trace/events/compaction.h | 38 +++++++++++++++++++++++++++++++++-----
 mm/compaction.c                   |  6 ++++--
 2 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index 36e2d6f..4d86769 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -158,12 +158,15 @@ TRACE_EVENT(mm_compaction_migratepages,
 );
 
 TRACE_EVENT(mm_compaction_begin,
-	TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
-		unsigned long free_pfn, unsigned long zone_end, bool sync),
+	TP_PROTO(struct zone *zone, unsigned long zone_start,
+		unsigned long migrate_pfn, unsigned long free_pfn,
+		unsigned long zone_end, bool sync),
 
-	TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync),
+	TP_ARGS(zone, zone_start, migrate_pfn, free_pfn, zone_end, sync),
 
 	TP_STRUCT__entry(
+		__field(int, nid)
+		__field(int, zid)
 		__field(unsigned long, zone_start)
 		__field(unsigned long, migrate_pfn)
 		__field(unsigned long, free_pfn)
@@ -172,6 +175,8 @@ TRACE_EVENT(mm_compaction_begin,
 	),
 
 	TP_fast_assign(
+		__entry->nid = zone_to_nid(zone);
+		__entry->zid = zone_idx(zone);
 		__entry->zone_start = zone_start;
 		__entry->migrate_pfn = migrate_pfn;
 		__entry->free_pfn = free_pfn;
@@ -179,7 +184,9 @@ TRACE_EVENT(mm_compaction_begin,
 		__entry->sync = sync;
 	),
 
-	TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s",
+	TP_printk("nid=%d zid=%d zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s",
+		__entry->nid,
+		__entry->zid,
 		__entry->zone_start,
 		__entry->migrate_pfn,
 		__entry->free_pfn,
@@ -221,7 +228,7 @@ TRACE_EVENT(mm_compaction_end,
 		__print_symbolic(__entry->status, COMPACTION_STATUS))
 );
 
-TRACE_EVENT(mm_compaction_try_to_compact_pages,
+TRACE_EVENT(mm_compaction_try_to_compact_pages_begin,
 
 	TP_PROTO(
 		int order,
@@ -248,6 +255,27 @@ TRACE_EVENT(mm_compaction_try_to_compact_pages,
 		(int)__entry->mode)
 );
 
+TRACE_EVENT(mm_compaction_try_to_compact_pages_end,
+
+	TP_PROTO(int rc, int contended),
+
+	TP_ARGS(rc, contended),
+
+	TP_STRUCT__entry(
+		__field(int, rc)
+		__field(int, contended)
+	),
+
+	TP_fast_assign(
+		__entry->rc = rc;
+		__entry->contended = contended;
+	),
+
+	TP_printk("rc=%s contended=%d",
+		__print_symbolic(__entry->rc, COMPACTION_STATUS),
+		__entry->contended)
+);
+
 DECLARE_EVENT_CLASS(mm_compaction_suitable_template,
 
 	TP_PROTO(struct zone *zone,
diff --git a/mm/compaction.c b/mm/compaction.c
index 7bc0477..dddd7c7 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1453,7 +1453,7 @@ static enum compact_result compact_zone(struct zone *zone, struct compact_contro
 
 	cc->last_migrated_pfn = 0;
 
-	trace_mm_compaction_begin(start_pfn, cc->migrate_pfn,
+	trace_mm_compaction_begin(zone, start_pfn, cc->migrate_pfn,
 				cc->free_pfn, end_pfn, sync);
 
 	migrate_prep_local();
@@ -1625,7 +1625,7 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
 	if (!order || !may_enter_fs || !may_perform_io)
 		return COMPACT_SKIPPED;
 
-	trace_mm_compaction_try_to_compact_pages(order, gfp_mask, mode);
+	trace_mm_compaction_try_to_compact_pages_begin(order, gfp_mask, mode);
 
 	/* Compact each zone in the list */
 	for_each_zone_zonelist_nodemask(zone, z, ac->zonelist, ac->high_zoneidx,
@@ -1711,6 +1711,8 @@ break_loop:
 	if (rc > COMPACT_INACTIVE && all_zones_contended)
 		*contended = COMPACT_CONTENDED_LOCK;
 
+	trace_mm_compaction_try_to_compact_pages_end(rc, *contended);
+
 	return rc;
 }
 
-- 
2.7.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]