[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200804180147.16d34809@oasis.local.home>
Date: Tue, 4 Aug 2020 18:01:47 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: SeongJae Park <sjpark@...zon.com>
Cc: <akpm@...ux-foundation.org>, SeongJae Park <sjpark@...zon.de>,
<Jonathan.Cameron@...wei.com>, <aarcange@...hat.com>,
<acme@...nel.org>, <alexander.shishkin@...ux.intel.com>,
<amit@...nel.org>, <benh@...nel.crashing.org>,
<brendan.d.gregg@...il.com>, <brendanhiggins@...gle.com>,
<cai@....pw>, <colin.king@...onical.com>, <corbet@....net>,
<david@...hat.com>, <dwmw@...zon.com>, <fan.du@...el.com>,
<foersleo@...zon.de>, <gthelen@...gle.com>, <irogers@...gle.com>,
<jolsa@...hat.com>, <kirill@...temov.name>, <mark.rutland@....com>,
<mgorman@...e.de>, <minchan@...nel.org>, <mingo@...hat.com>,
<namhyung@...nel.org>, <peterz@...radead.org>,
<rdunlap@...radead.org>, <riel@...riel.com>, <rientjes@...gle.com>,
<rppt@...nel.org>, <sblbir@...zon.com>, <shakeelb@...gle.com>,
<shuah@...nel.org>, <sj38.park@...il.com>, <snu@...zon.de>,
<vbabka@...e.cz>, <vdavydov.dev@...il.com>,
<yang.shi@...ux.alibaba.com>, <ying.huang@...el.com>,
<linux-damon@...zon.com>, <linux-mm@...ck.org>,
<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v19 08/15] mm/damon: Add a tracepoint
On Tue, 4 Aug 2020 11:14:09 +0200
SeongJae Park <sjpark@...zon.com> wrote:
> From: SeongJae Park <sjpark@...zon.de>
>
> This commit adds a tracepoint for DAMON. It traces the monitoring
> results of each region for each aggregation interval. Using this, DAMON
> can easily integrated with tracepoints supporting tools such as perf.
>
> Signed-off-by: SeongJae Park <sjpark@...zon.de>
> Reviewed-by: Leonard Foerster <foersleo@...zon.de>
> ---
> include/trace/events/damon.h | 43 ++++++++++++++++++++++++++++++++++++
> mm/damon.c | 4 ++++
> 2 files changed, 47 insertions(+)
> create mode 100644 include/trace/events/damon.h
>
> diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h
> new file mode 100644
> index 000000000000..2f422f4f1fb9
> --- /dev/null
> +++ b/include/trace/events/damon.h
> @@ -0,0 +1,43 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM damon
> +
> +#if !defined(_TRACE_DAMON_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_DAMON_H
> +
> +#include <linux/damon.h>
> +#include <linux/types.h>
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(damon_aggregated,
> +
> + TP_PROTO(struct damon_target *t, struct damon_region *r,
> + unsigned int nr_regions),
> +
> + TP_ARGS(t, r, nr_regions),
> +
> + TP_STRUCT__entry(
> + __field(unsigned long, target_id)
> + __field(unsigned int, nr_regions)
> + __field(unsigned long, start)
> + __field(unsigned long, end)
> + __field(unsigned int, nr_accesses)
> + ),
> +
> + TP_fast_assign(
> + __entry->target_id = t->id;
> + __entry->nr_regions = nr_regions;
> + __entry->start = r->ar.start;
> + __entry->end = r->ar.end;
> + __entry->nr_accesses = r->nr_accesses;
> + ),
> +
> + TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u",
> + __entry->target_id, __entry->nr_regions,
> + __entry->start, __entry->end, __entry->nr_accesses)
> +);
> +
> +#endif /* _TRACE_DAMON_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> diff --git a/mm/damon.c b/mm/damon.c
> index b3420ba97fd2..65e65e779313 100644
> --- a/mm/damon.c
> +++ b/mm/damon.c
> @@ -20,6 +20,8 @@
>
> #define pr_fmt(fmt) "damon: " fmt
>
> +#define CREATE_TRACE_POINTS
> +
> #include <linux/damon.h>
> #include <linux/delay.h>
> #include <linux/kthread.h>
> @@ -31,6 +33,7 @@
> #include <linux/sched/mm.h>
> #include <linux/sched/task.h>
> #include <linux/slab.h>
It's best to place the #define CREATE_TRACE_POINTS here, so that it
doesn't cause any side effects when including the other headers.
Other than that:
Reviewed-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
-- Steve
> +#include <trace/events/damon.h>
>
> /* Minimal region size. Every damon_region is aligned by this. */
> #define MIN_REGION PAGE_SIZE
> @@ -856,6 +859,7 @@ static void kdamond_reset_aggregated(struct damon_ctx *c)
> damon_write_rbuf(c, &r->ar.end, sizeof(r->ar.end));
> damon_write_rbuf(c, &r->nr_accesses,
> sizeof(r->nr_accesses));
> + trace_damon_aggregated(t, r, nr);
> r->nr_accesses = 0;
> }
> }
Powered by blists - more mailing lists