Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1790368ybt; Mon, 15 Jun 2020 09:26:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9eG3R3vVZOEj/xaGmVVW3z4nRWWdm1y/K0ccd10rMiD85RoyFcy3Q7IRKztEnzw1Bvh+X X-Received: by 2002:a17:906:c1c4:: with SMTP id bw4mr13623239ejb.452.1592238419707; Mon, 15 Jun 2020 09:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592238419; cv=none; d=google.com; s=arc-20160816; b=1HKq04QGRUwqj8ZescmVK83T176J89t34/bRS0a3LZc6cIVoV2Nsa7GHc4qT4JLD1l T8YBt2BWY6p/0cUB14mp1VMLQIEm1ujJE6gioeZuVfMOXmB8IgpYhpR29Zrpo+opEZR+ 7E4vgE8PL2/LCURcmCxWY58YEfiIJ4/c0l6Ze5cTjuXwe2Id39VRIL24uQf/girzcFzh jlPHqS6JfLcWQZlrvjpxAEjRdMQvMeHMN6OOZWVtIUhavCFMXecZ2x0rpMz+QUhXTGZn G/I33Ud+/maN551F5A7wOeswjoPd2viPrmtQMr8w/gXv3/XdYKjCQjrBydFooGJy97+X tgsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:dkim-signature; bh=YaFHcqZW0FMcNim7/R1qF5gJYJZsO8kpaET64kTVxgo=; b=NG/J+FdOFQrZsP/+/LJ/HfegQ2hgBxjkAoq9lD0+4BzA4+8S1ttTbkihLwQjtKfVEU 9XOgVhRyRq79zTSRHwmHy4cwFPq49QddKPwNJZlU/3QbHPtPUY/hUmC/b53/I1oOFKBV Udo1DWgWhXH1n9OGy64uZryORykTvESdWDFagJvUY6Yt+D73TeGZrem/it8WhDkbE+Qi 8e/g67CaCKNolJOg75vrwFil+Qd3FMcgeGIX0QxYs7HgFQVShiYDdhtILzz/Fc+3AoTr 94KoUsN6V4gaI0qfYe8Xhau95AngRudkfMydDKNqv4z4OHWC0LpW65cwWAFpdr3wns0y mgsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=DC0KP1Ek; 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 d18si8736391edr.366.2020.06.15.09.26.36; Mon, 15 Jun 2020 09:26:59 -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=DC0KP1Ek; 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 S1731039AbgFOQWc (ORCPT + 99 others); Mon, 15 Jun 2020 12:22:32 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:60364 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727785AbgFOQWb (ORCPT ); Mon, 15 Jun 2020 12:22:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1592238151; x=1623774151; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=YaFHcqZW0FMcNim7/R1qF5gJYJZsO8kpaET64kTVxgo=; b=DC0KP1EkO1tNDsPh3/HyqwNzcp2comKn2kHQDgciNfRXrkjhxPf4gJxH DaK97Vu1n03oihe7QWNU0u3UMu7e0EPV/J8ti9ADQDpSjeZXWPCTz58iG jlMIABnUKCQ9vacEJdfizjE7EryGjF2S4h+Z6jgMdI47xXWC4Od6EL4Am 4=; IronPort-SDR: ZHxPVJlb3KEvQKUvN6C7BxMf5f42fYSw7kphF/O1gke3U7nw0HzdsOGVAywg3rrn5qV/G35Q9b 8apl24hzvfkg== X-IronPort-AV: E=Sophos;i="5.73,515,1583193600"; d="scan'208";a="36290747" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2c-c6afef2e.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 15 Jun 2020 16:22:26 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2c-c6afef2e.us-west-2.amazon.com (Postfix) with ESMTPS id 893E0A23DC; Mon, 15 Jun 2020 16:22:24 +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; Mon, 15 Jun 2020 16:22:24 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.161.145) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 15 Jun 2020 16:22:07 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v16 08/14] mm/damon: Add tracepoints Date: Mon, 15 Jun 2020 18:19:21 +0200 Message-ID: <20200615161927.12637-9-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200615161927.12637-1-sjpark@amazon.com> References: <20200615161927.12637-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.145] X-ClientProxiedBy: EX13D23UWA004.ant.amazon.com (10.43.160.72) 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 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 | 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..40b249a28b30 --- /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_task *t, struct damon_region *r, + unsigned int nr_regions), + + TP_ARGS(t, r, nr_regions), + + TP_STRUCT__entry( + __field(int, pid) + __field(unsigned int, nr_regions) + __field(unsigned long, start) + __field(unsigned long, end) + __field(unsigned int, nr_accesses) + ), + + TP_fast_assign( + __entry->pid = t->pid; + __entry->nr_regions = nr_regions; + __entry->start = r->ar.start; + __entry->end = r->ar.end; + __entry->nr_accesses = r->nr_accesses; + ), + + TP_printk("pid=%d nr_regions=%u %lu-%lu: %u", __entry->pid, + __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.c b/mm/damon.c index 006bb66c6cf6..56f193f30275 100644 --- a/mm/damon.c +++ b/mm/damon.c @@ -19,6 +19,8 @@ #define pr_fmt(fmt) "damon: " fmt +#define CREATE_TRACE_POINTS + #include #include #include @@ -29,6 +31,7 @@ #include #include #include +#include /* Minimal region size. Every damon_region is aligned by this. */ #define MIN_REGION PAGE_SIZE @@ -782,6 +785,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; } } -- 2.17.1