Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3310540pxu; Tue, 15 Dec 2020 04:06:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQ4Z0xsj3xG4FRzs8VEVEU5DsyrKBoVKrVprmzAUpJmZpEGBWO3yiJbKrxtebMHMKW3GiP X-Received: by 2002:a05:6402:3048:: with SMTP id bu8mr11289471edb.49.1608033967961; Tue, 15 Dec 2020 04:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608033967; cv=none; d=google.com; s=arc-20160816; b=09nKfGBcomxC3tzRlffJrovzZglQxZn4/1iVkvWTDOeJ1Gd39L1wnpVGDUPJzF0Xl2 r40puioKD/jKYodqLc3LJQ6xma+rGSnIuKJSmvJMw4j+uZjoytWiIH6N8KBjkxG5gWLo 6u5lvvvebOgVIOLT1yL1dZrKUjsbDMOdvkybWjQf3OwqhnrxQ/tapPF7wuHmCcTPQaMA EIrn0WadU2wB+3jiaLRi0aTI1zbS0/uRkhwpylRL6DfEfrj09XPqcgrhCDYQFy6OnBHO FKc1/GW2Joot84rYpmjmP4DejYZML+dDd52FTddYLEMqmBlYtNffyeZfEh+cR/MQukSf 5Dtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YFQHSMTSB3FR2oCFJrUxmUoQTFo+oRQbGyfrImXtuWA=; b=qsdD8PixKcrB0os2NHbcLVFx5s50+vAeukSna2UL4YgOrJEgaBPoQGKBI/i48HBO+D nmWTpzCDFgRIT3ldyzfMjf+IMvbGEvA11845ruoeGle/NaBBWSR47YnYamrCHbqkVeUq fTOTcCoHr3MvymlJmM5vspHZ0C3WFIEEzUuJ/j5qNV0BihmuPFwvJwss3dN9fyKQ0YxU 5gYmoIBpdD0endnJXeaAmpTzTGh3t3WuW3rn4K9FuYOfFvDqDFlnpRkPqOKNMy3sD/Qj QtNJV7BbCFrqRc7qpny5elBf+nY4ir9X3mXxfC7VvETmiX308x15imeMyPCb59gS8VUf CLVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=UcdKlBk8; 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 dn9si701499edb.347.2020.12.15.04.05.44; Tue, 15 Dec 2020 04:06:07 -0800 (PST) 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=UcdKlBk8; 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 S1728867AbgLOL7o (ORCPT + 99 others); Tue, 15 Dec 2020 06:59:44 -0500 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:53474 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728908AbgLOL71 (ORCPT ); Tue, 15 Dec 2020 06:59:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1608033568; x=1639569568; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=YFQHSMTSB3FR2oCFJrUxmUoQTFo+oRQbGyfrImXtuWA=; b=UcdKlBk8R9ij+RSOOZgNNc2SNd7CeQwMIYu9G8v/DdkVvQcKA5yRq0tu 4kfBO6G7bx+Qhz4qN3znqHk07EDLoRBCeQhvsNsxwFZYTM10Wh+8Xnsfg JXcjj7IJyM62ggVs/neBrtvR/Utna9M9tkR3mwOrUNOPPSwdJ82qtky7j w=; X-IronPort-AV: E=Sophos;i="5.78,420,1599523200"; d="scan'208";a="71288003" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1a-16acd5e0.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 15 Dec 2020 11:58:40 +0000 Received: from EX13D31EUA001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan2.iad.amazon.com [10.40.163.34]) by email-inbound-relay-1a-16acd5e0.us-east-1.amazon.com (Postfix) with ESMTPS id 37761A213D; Tue, 15 Dec 2020 11:58:27 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.162.252) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 15 Dec 2020 11:58:11 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v23 06/15] mm/damon: Add a tracepoint Date: Tue, 15 Dec 2020 12:54:39 +0100 Message-ID: <20201215115448.25633-7-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201215115448.25633-1-sjpark@amazon.com> References: <20201215115448.25633-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.252] X-ClientProxiedBy: EX13D33UWC002.ant.amazon.com (10.43.162.11) To EX13D31EUA001.ant.amazon.com (10.43.165.15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 can easily integrated with tracepoints supporting tools such as perf. Signed-off-by: SeongJae Park Reviewed-by: Leonard Foerster Reviewed-by: Steven Rostedt (VMware) --- include/trace/events/damon.h | 43 ++++++++++++++++++++++++++++++++++++ mm/damon/core.c | 7 +++++- 2 files changed, 49 insertions(+), 1 deletion(-) 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 +#include +#include + +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 diff --git a/mm/damon/core.c b/mm/damon/core.c index 0f9beb60d9dd..5ca9f79ccbb6 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -13,6 +13,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + /* Get a random number in [l, r) */ #define damon_rand(l, r) (l + prandom_u32_max(r - l)) @@ -384,8 +387,10 @@ static void kdamond_reset_aggregated(struct damon_ctx *c) damon_for_each_target(t, c) { struct damon_region *r; - damon_for_each_region(r, t) + damon_for_each_region(r, t) { + trace_damon_aggregated(t, r, damon_nr_regions(t)); r->nr_accesses = 0; + } } } -- 2.17.1