Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2222927pxa; Mon, 17 Aug 2020 04:31:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5iP3HCjcw78/pN0o3mF8/tUp9gSG5dfUfOoE85cZU/7apTvxG/2nsTVeABK5zK+xRg2tK X-Received: by 2002:a50:fd8d:: with SMTP id o13mr14855605edt.313.1597663892600; Mon, 17 Aug 2020 04:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597663892; cv=none; d=google.com; s=arc-20160816; b=msrRi5Ef8ebey10K9JJZUo9wDmlVrtuTvkW6zWAduU4Db4n2QIZsOiOtcYYZVLGHo3 KiugzkzJFLhmb/mD2OMvl1kWuX23HCB6OBhEJI04Lt2cRs2PdAykX7/HDJKwEHKd1qWf ViWY0qpIAfwOCoYjSwiKMwy0F+puWo1kO2wV7L062v/OlY2ENcpAQ00UN8OeJ54k6Hok i0NqFSZM0dX9WbaXCFKDHeNS8KVEz7mb+olq+1XJI638hcDi8r5bkbBwfgLFsilP6tQ4 /eFbZMjcSniy0Cn4mzA/H7Mw7Dolfd63P860VXbNk1mLU12t/Rm61d5VzMWu2Wb/GiUn 9C5Q== 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:dkim-signature; bh=6NvUzrujb89qsZsHyhVnjbsbayGnmDOoQYD6DeYjvPw=; b=xDGEkMbPE976+BBzvpGjfOvn65EA7hOBRuE58bsZ3oIfSWo3nn6hKve+NPoN16Zx5C lCT6RTZKUzgr3J39I8uiGocFFndMVxy0FCkeIwetGYHyVDQDNj6e1BnTm2Dwc/fbm9zp NiriLLyfnF7etP66DnBqu6PP9XmEWAXhdErOvztCEt6xmxq6+w2T4oj4AHiWax+LINYq W+ZI5TsmW1QU/d4pKIFSnaEC91CRT8HSkB+jkU3Yx21t9ndoGFfI0kI9XuBCohSAz7ry 1eUeuL0l0q3J0wAWIivxcIVqLmX5y2aEtOisnYgpnhT39beihbC08H7zsSCxXsP408C3 dOpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=laNY22kG; 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 h14si11302442ejd.603.2020.08.17.04.31.09; Mon, 17 Aug 2020 04:31:32 -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=laNY22kG; 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 S1726287AbgHQK4Q (ORCPT + 99 others); Mon, 17 Aug 2020 06:56:16 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:24588 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728207AbgHQKzZ (ORCPT ); Mon, 17 Aug 2020 06:55:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1597661724; x=1629197724; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=6NvUzrujb89qsZsHyhVnjbsbayGnmDOoQYD6DeYjvPw=; b=laNY22kGvW4MS++B9GdMIu5tnnBDUepMBgGKyRosrinKx9FcExIbjnlm D5T8a0dzkdD1NEmTQo3w0MMau3uDGqcGiHbh+ALueXEueqZDe4Xhah29g RLC0Z7DrYshl7w8qtQ4sekIMOs3NnA89U9Idl8kAvoHnXfR2wWetRJA7K Q=; X-IronPort-AV: E=Sophos;i="5.76,322,1592870400"; d="scan'208";a="48182204" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-74cf8b49.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 17 Aug 2020 10:55:24 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-74cf8b49.us-east-1.amazon.com (Postfix) with ESMTPS id 72382C06EF; Mon, 17 Aug 2020 10:55:12 +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, 17 Aug 2020 10:55:11 +0000 Received: from u3f2cd687b01c55.ant.amazon.com (10.43.160.192) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 17 Aug 2020 10:54:54 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v20 08/15] mm/damon: Add a tracepoint Date: Mon, 17 Aug 2020 12:51:30 +0200 Message-ID: <20200817105137.19296-9-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200817105137.19296-1-sjpark@amazon.com> References: <20200817105137.19296-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.192] X-ClientProxiedBy: EX13D02UWC004.ant.amazon.com (10.43.162.236) 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 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.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..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.c b/mm/damon.c index fed35f7b3879..e52e107c90fd 100644 --- a/mm/damon.c +++ b/mm/damon.c @@ -32,6 +32,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + /* Minimal region size. Every damon_region is aligned by this. */ #define MIN_REGION PAGE_SIZE @@ -870,6 +873,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