Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1387775ybg; Tue, 2 Jun 2020 08:38:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy++s+8AdW07mNNoMOuj/fBWBqr95wUO3vSBdcWzfhVuvL+CQEIU8a4hizANlQt5HzSg0W8 X-Received: by 2002:a50:fe07:: with SMTP id f7mr25948637edt.315.1591112295129; Tue, 02 Jun 2020 08:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591112295; cv=none; d=google.com; s=arc-20160816; b=CGMK+Ue0IOwK/hSNXAGyS4cIZT7Ko4vuCh1MDXYQi80mJrDU/lQgiRnjpIn8CK8zab H7mnxvyxCEQFut+EOQCuBHWGEEzPZvnNdMXlkPnZMW/xz0tlxVu2eXoC0Lecic1Qw/mH TJRuBwW/mcXOMeJKx/1LEpdwj3cxaVwmXeeeSI8pkg9sGT9umM6D7MQhjc77dxh4Oo0L b5nJVBYgoDWHaoUGm1Egl4NGQzyQkHCFoZFdvYOEHsj15QvkEg2CSNFHnvyXr0CeUOUD HPYS2XBUYa6nonKX0mGnl+3rqxjyjFJFuc4ISdz/bdIBFW+v6eHjJ/S2StiM7dAqTs89 3euQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=XKfZuYt/CV174PcIc1keOSV1YpzNEr1u0PZcca3m8C4=; b=jzVTvGffr9u5f0u2AimFTWfkaJmdJCoBTirZvXJZIUuxL+7KawtztT8nDPERmzaojP 8NuKM3HlSFwgU2SZLNduwYw7N/3YibuW4u3rVsvFvO6mYuepNga0fgQxEMkXrlC+u+7/ +VkLsZ4qlzSF/n0Cu9z13MYmDL7YkiyjVM2vJbdOFgex1pVYyHLTehY2LZCKPmN8DmhG EAxtj8ZQOl+AtmmsbXK0I9ikEvH+UMOcO3QWgXrh0qafa9rLGgX0EjBPYS2d41BPk/gx 4fj5e2JzpRXD1QQXK21U54mau/PpYPfQEDZqYGG4fpGjhP3Xfb5KB3OhnK80Ov4YTulx Qqew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk3si1675678edb.580.2020.06.02.08.37.51; Tue, 02 Jun 2020 08:38:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726814AbgFBPfm (ORCPT + 99 others); Tue, 2 Jun 2020 11:35:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:40232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726311AbgFBPfl (ORCPT ); Tue, 2 Jun 2020 11:35:41 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; > } > }