From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19082C433E2 for ; Tue, 2 Jun 2020 15:35:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BFB71207ED for ; Tue, 2 Jun 2020 15:35:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFB71207ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4228780007; Tue, 2 Jun 2020 11:35:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AAE18E0006; Tue, 2 Jun 2020 11:35:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BF4580007; Tue, 2 Jun 2020 11:35:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id 11F438E0006 for ; Tue, 2 Jun 2020 11:35:43 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B42EF8245578 for ; Tue, 2 Jun 2020 15:35:42 +0000 (UTC) X-FDA: 76884671724.21.milk86_14ac16c7ffe48 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 8CCAF1844CAB0 for ; Tue, 2 Jun 2020 15:35:42 +0000 (UTC) X-HE-Tag: milk86_14ac16c7ffe48 X-Filterd-Recvd-Size: 5553 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 2 Jun 2020 15:35:41 +0000 (UTC) Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 68DE720674; Tue, 2 Jun 2020 15:35:37 +0000 (UTC) Date: Tue, 2 Jun 2020 11:35:36 -0400 From: Steven Rostedt To: SeongJae Park Cc: , SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v14 09/15] mm/damon: Add tracepoints Message-ID: <20200602113536.16e8e767@gandalf.local.home> In-Reply-To: <20200602131249.22765-1-sjpark@amazon.com> References: <20200602130125.20467-1-sjpark@amazon.com> <20200602131249.22765-1-sjpark@amazon.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 8CCAF1844CAB0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 2 Jun 2020 15:12:49 +0200 SeongJae Park wrote: > From: SeongJae Park > > This commit adds a tracepoint for DAMON. It traces the monitoring > results of each region for each aggregation interval. Using this, DAMON > will be easily integrated with any tracepoints supporting tools such as > perf. > > Signed-off-by: SeongJae Park > Reviewed-by: Leonard Foerster > --- > include/trace/events/damon.h | 43 ++++++++++++++++++++++++++++++++++++ > mm/damon.c | 5 +++++ > 2 files changed, 48 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..22236642d366 > --- /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 > +#include > + > +TRACE_EVENT(damon_aggregated, > + > + TP_PROTO(int pid, unsigned int nr_regions, > + unsigned long vm_start, unsigned long vm_end, > + unsigned int nr_accesses), > + > + TP_ARGS(pid, nr_regions, vm_start, vm_end, nr_accesses), > + > + TP_STRUCT__entry( > + __field(int, pid) > + __field(unsigned int, nr_regions) > + __field(unsigned long, vm_start) > + __field(unsigned long, vm_end) > + __field(unsigned int, nr_accesses) > + ), > + > + TP_fast_assign( > + __entry->pid = pid; > + __entry->nr_regions = nr_regions; > + __entry->vm_start = vm_start; > + __entry->vm_end = vm_end; > + __entry->nr_accesses = nr_accesses; > + ), > + > + TP_printk("pid=%d nr_regions=%u %lu-%lu: %u", __entry->pid, > + __entry->nr_regions, __entry->vm_start, > + __entry->vm_end, __entry->nr_accesses) > +); > + > +#endif /* _TRACE_DAMON_H */ > + > +/* This part must be outside protection */ > +#include > diff --git a/mm/damon.c b/mm/damon.c > index 6b0b8f21a6c6..af6f395fe06c 100644 > --- a/mm/damon.c > +++ b/mm/damon.c > @@ -9,6 +9,8 @@ > > #define pr_fmt(fmt) "damon: " fmt > > +#define CREATE_TRACE_POINTS > + > #include > #include > #include > @@ -20,6 +22,7 @@ > #include > #include > #include > +#include > > /* Minimal region size. Every damon_region is aligned by this. */ > #define MIN_REGION PAGE_SIZE > @@ -650,6 +653,8 @@ static void kdamond_reset_aggregated(struct damon_ctx *c) > damon_write_rbuf(c, &r->vm_end, sizeof(r->vm_end)); > damon_write_rbuf(c, &r->nr_accesses, > sizeof(r->nr_accesses)); > + trace_damon_aggregated(t->pid, nr, > + r->vm_start, r->vm_end, r->nr_accesses); For a little better code, what about passing in t and r directly, and then having the TP_fast_assign just do the dereferencing there? __entry->pid = t->pid; __entry->vm_start = r->vm_start; __entry->vm_end = r->vm_end; __entry->nr_accesses = r->nr_accesses; It will produce better code at the trace point call (which is the important part) and make the trace event a bit more flexible in the future, without having to modify the call site. -- Steve > r->nr_accesses = 0; > } > }