Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4313031ybg; Mon, 8 Jun 2020 04:52:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzchw7hzln1DPnHgO7RIxAuecRqqaPfANCNRwwRFQ1hCc9AmBMvT6YS6q9a0w+8IOy2jg88 X-Received: by 2002:aa7:da8c:: with SMTP id q12mr22103462eds.385.1591617125338; Mon, 08 Jun 2020 04:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591617125; cv=none; d=google.com; s=arc-20160816; b=oD4fWxaUksijHTJKMjdoTR1PMKap/WpyRYUrmAd5XEkP1ZBzzuPtj2T0ETOamzZt98 mh7tS9r/Q3V6EA4MhWWNYW6NpfjXpc8Wp7d+bWkZWE21MsOouI1O0yYGpx4I5VkC034/ VaiaqIKWQlVgwArXjywB8y7XUl3LnsBOWbpyrtrlihBIMEXT2S3qKI6QgCSlk1xicyln 9bEh9JDNBOBG9lxWzFuB0EQjDN+3YMss8JkDD4xKHlsRopCKxEdAUert/+BU8Tp2kEaD 1Iu9O+deNvkMTiGEpnZlYMykzWVS+tAEBgpmb506/JVCRJ6d5YD0MFfhQx5dvgmINJbU c1wA== 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=kDSfYo/pEL2V4DC4paX/UN8Ve85oIzfba5PrIPdCZmY=; b=zcGjaor0oJbnZbGTAQkxFb1EaIVw1CmKdq2Eaf/pEFdN5HN7f2T2crB9DF8e3Mdq7p aOUSJsnIAIBuz2NxBY8nT6HPvKkOiukw37NPY6a4wl/Mxhfp8tKOoyYLc2P2jqPJ7w58 BNSHQp4LUSeJ6yJG6m2s1+Xb6wXsIyA6Z8T58kIOer8ua1CVZlsmZTG73Zxi39KJXw/k ZXEUL/7+pBpZrZ5lx2WTmaJXua1BVLw7LUm4B71l/OBTad4HTe/pWZPKvPqALHgR8Cwk pN2V7VjfQ0Qz1A7lxOJJc45dpNTw5w8ZZ1Js1PY9qao4X1f1Pg7KCZD2ckIJiN1Rf0nz 89sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=IZsYSWSc; 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 t9si8361703ejd.172.2020.06.08.04.51.42; Mon, 08 Jun 2020 04:52:05 -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=IZsYSWSc; 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 S1729642AbgFHLrw (ORCPT + 99 others); Mon, 8 Jun 2020 07:47:52 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:62193 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726434AbgFHLrv (ORCPT ); Mon, 8 Jun 2020 07:47:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1591616871; x=1623152871; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=kDSfYo/pEL2V4DC4paX/UN8Ve85oIzfba5PrIPdCZmY=; b=IZsYSWScAyU6oM6vdMpZWcgrni2OgY2yd7BExcwMk92Bx8zFvkDK8agS 1fTLBizEt44uuviO74NxB8bniNC1z+2AMo7OA+25c2bKWXknkG3GWNtaq ORcEEjM6S6NdIW7TBAsyCZfyLE+UIKD0vQGLsdW96jt/RrcbWs+J18L81 U=; IronPort-SDR: 5h4QT/qLHtN14Nctw3SJktE3UxI3R2i1nXt8bGuTi6hb0Er6OwiutJitKC1OTb3EIuQ8RWfeyi rt13MiJ68A/g== X-IronPort-AV: E=Sophos;i="5.73,487,1583193600"; d="scan'208";a="34926634" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1a-807d4a99.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 08 Jun 2020 11:47:50 +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-807d4a99.us-east-1.amazon.com (Postfix) with ESMTPS id 7B779A229A; Mon, 8 Jun 2020 11:47:39 +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, 8 Jun 2020 11:47:38 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.162.53) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Jun 2020 11:47:21 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v15 09/14] mm/damon: Add tracepoints Date: Mon, 8 Jun 2020 13:40:42 +0200 Message-ID: <20200608114047.26589-10-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200608114047.26589-1-sjpark@amazon.com> References: <20200608114047.26589-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.53] X-ClientProxiedBy: EX13D46UWB004.ant.amazon.com (10.43.161.204) 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..fd260463d5b8 --- /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, vm_start) + __field(unsigned long, vm_end) + __field(unsigned int, nr_accesses) + ), + + TP_fast_assign( + __entry->pid = t->pid; + __entry->nr_regions = nr_regions; + __entry->vm_start = r->vm_start; + __entry->vm_end = r->vm_end; + __entry->nr_accesses = r->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 010806b7f92e..1ebf9af40499 100644 --- a/mm/damon.c +++ b/mm/damon.c @@ -20,6 +20,8 @@ #define pr_fmt(fmt) "damon: " fmt +#define CREATE_TRACE_POINTS + #include #include #include @@ -31,6 +33,7 @@ #include #include #include +#include /* Minimal region size. Every damon_region is aligned by this. */ #define MIN_REGION PAGE_SIZE @@ -762,6 +765,7 @@ 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, r, nr); r->nr_accesses = 0; } } -- 2.17.1