Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1393537ybg; Tue, 2 Jun 2020 08:47:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw//l+aOle9XcioHd1QPnSM7WX+AQTP36j/RPOoq3rbTo1YmBtJmPW384d+ChAFr3E+ny7L X-Received: by 2002:a50:e711:: with SMTP id a17mr27273299edn.369.1591112835798; Tue, 02 Jun 2020 08:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591112835; cv=none; d=google.com; s=arc-20160816; b=danLgAksgrFlz7Kc3Gsg7lARGPtnL4iH0+7M/Nc8CFijI/MkjCGp2glh7txkfSquPp Td332D6i9IUlUcyVJaR1rQqPZfjPKEsmVNNrMlrxJiNfX4cnBnl2PCjXvEnNfYrSdvyJ l9nkP0/+wtFgphRa1AR4t8KqW5ifKRQGr6ZMIfpR3qnAt7K5KbcKJJ99DXbz0gM1UcU4 c/dUMec2k7nzb8uaPyqNqm52IcBS3LpnmD+C1i0/HZMU0Suu9p8J+/HQadiI2ZVK+6g4 H54WH6u5rC5LM16XaLCFR5Mp7RA3Q09yRg2JvqD+hBzuqUeBOUXo7akZJycFjPF5XRVw ezLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:dkim-signature; bh=xo5iQNh2u9O4I7ZyRk3wLunxD/gOFcQ/CX+VsNZiQws=; b=XlzQR/NdPKrBDtP9GaUUpSi1C5+3mJnACJHDsnCVZTjJnv7yLigLH6Rg8G12feoNYY jsgaZOcsn3+fg7PQfVXTjJvKKueVexZxAdRBGvvTkbAlqNdsWqYGGRXePt5jR2t+uhA/ fYNTrfsm7HXbGrMqI4ClHjml3D+O4VKlQvaWBsxlPqygkI/UMiD3PZfrLNPLEsWczGft 65jLjGxj85XRWfpyUEwd1lwT6/jh6zfOGsT/ZNFl19sEetVtguBNfF6VXY1J/wuWtlBC K7Iu4qLNswg55ttgOIjjkMhgrnlzgAD14EWBuP4NkHEjrHedkexcLCAEJfKxQ5XI9hGo TYdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=VrC6MuQA; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b22si1773485edw.120.2020.06.02.08.46.52; Tue, 02 Jun 2020 08:47: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; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=VrC6MuQA; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727788AbgFBPn3 (ORCPT + 99 others); Tue, 2 Jun 2020 11:43:29 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:53681 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727070AbgFBPn2 (ORCPT ); Tue, 2 Jun 2020 11:43:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1591112607; x=1622648607; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=xo5iQNh2u9O4I7ZyRk3wLunxD/gOFcQ/CX+VsNZiQws=; b=VrC6MuQAPd0vEY93v9lGPqFcpWi29adR1d+8WV/4he+o3zJxXgDGBxu8 FfFsl2vYunIIdCLWScA40Bb33bLG3QVsekGWVnDQODeYwc1Fb1UDktFj5 wxHZMc0bgIdMk+Jm4/miPOXKrBm+1ozJFWxcF8BwL14xI1H3py4YlKDis Y=; IronPort-SDR: 2XGqGmkKWyxqG6NkZJ8CgeI5Dq3JIkhit5hVVFb0kIskPSovnTNXNe/s+8uaOszlPilgH3s4v3 +BcfWsBqjocg== X-IronPort-AV: E=Sophos;i="5.73,465,1583193600"; d="scan'208";a="47881129" Received: from sea32-co-svc-lb4-vlan2.sea.corp.amazon.com (HELO email-inbound-relay-1a-715bee71.us-east-1.amazon.com) ([10.47.23.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 02 Jun 2020 15:43:10 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-715bee71.us-east-1.amazon.com (Postfix) with ESMTPS id 01269A2242; Tue, 2 Jun 2020 15:43:07 +0000 (UTC) Received: from EX13D31EUA001.ant.amazon.com (10.43.165.15) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 2 Jun 2020 15:43:07 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.161.82) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 2 Jun 2020 15:42:51 +0000 From: SeongJae Park To: Steven Rostedt CC: SeongJae Park , , "SeongJae Park" , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: Re: [PATCH v14 09/15] mm/damon: Add tracepoints Date: Tue, 2 Jun 2020 17:42:34 +0200 Message-ID: <20200602154234.26962-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200602113536.16e8e767@gandalf.local.home> (raw) MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.82] X-ClientProxiedBy: EX13D24UWA004.ant.amazon.com (10.43.160.233) To EX13D31EUA001.ant.amazon.com (10.43.165.15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2 Jun 2020 11:35:36 -0400 Steven Rostedt wrote: > 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. Good point, I will do so in the next spin! Thanks, SeongJae Park > > -- Steve > > > > r->nr_accesses = 0; > > } > > }