mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Janani Ravichandran <janani.rvchndrn@gmail.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: riel@surriel.com, akpm@linux-foundation.org, hannes@compxchg.org,
	vdavydov@virtuozzo.com, mhocko@suse.com, vbabka@suse.cz,
	mgorman@techsingularity.net, kirill.shutemov@linux.intel.com,
	bywxiaobai@163.com, rostedt@goodmis.org
Subject: [PATCH 2/2] mm: compaction.c: Add/Modify direct compaction tracepoints
Date: Wed, 27 Jul 2016 10:51:03 -0400	[thread overview]
Message-ID: <7d2c2beef96e76cb01a21eee85ba5611bceb4307.1469629027.git.janani.rvchndrn@gmail.com> (raw)
In-Reply-To: <cover.1469629027.git.janani.rvchndrn@gmail.com>

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@gmail.com>
---
 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

  parent reply	other threads:[~2016-07-27 14:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 14:43 [PATCH 0/2] New tracepoints for slowpath and memory compaction Janani Ravichandran
2016-07-27 14:47 ` [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Janani Ravichandran
2016-07-27 15:23   ` Steven Rostedt
2016-07-27 17:20     ` Dave Hansen
2016-07-27 17:30       ` Steven Rostedt
2016-07-28 20:11     ` Janani Ravichandran
2016-08-04 15:19       ` Steven Rostedt
2016-08-05 16:03         ` Janani Ravichandran
2016-08-05 16:30           ` Steven Rostedt
2016-08-07 10:36             ` Janani Ravichandran
2016-07-27 16:33   ` Michal Hocko
2016-07-27 18:16     ` Rik van Riel
2016-07-27 18:28       ` Steven Rostedt
2016-07-27 18:44       ` Michal Hocko
2016-07-27 18:57         ` Rik van Riel
2016-07-27 14:51 ` Janani Ravichandran [this message]
2016-07-27 15:24   ` [PATCH 2/2] mm: compaction.c: Add/Modify direct compaction tracepoints Steven Rostedt
2016-08-01 13:25   ` Vlastimil Babka
2016-08-07 12:32     ` Janani Ravichandran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7d2c2beef96e76cb01a21eee85ba5611bceb4307.1469629027.git.janani.rvchndrn@gmail.com \
    --to=janani.rvchndrn@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bywxiaobai@163.com \
    --cc=hannes@compxchg.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=riel@surriel.com \
    --cc=rostedt@goodmis.org \
    --cc=vbabka@suse.cz \
    --cc=vdavydov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®