Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2817263ybz; Mon, 27 Apr 2020 05:11:55 -0700 (PDT) X-Google-Smtp-Source: APiQypLm5ye72N1SK1Q/teP6F62Hg2Vn+uh4cQWxu1uhmyqJe5C4fO4KiXfetNgq3iu52h68XF/Z X-Received: by 2002:a05:6402:3136:: with SMTP id dd22mr17921917edb.165.1587989515611; Mon, 27 Apr 2020 05:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587989515; cv=none; d=google.com; s=arc-20160816; b=YrkOWPbbCkrY13qMsfeZl+WqEEWw52m+h2j5DWg9CXQQRz5w0yypYwZS6Yt/Qgtrwb sCPhkggDmafCyMyjanYMqy62BSri3Xw6iCkuZDkXPuxrfJbHz5Zmik2siNFFW/1onkFO RQ/jLDKJWggxWUmG+gIQTMWAXGA0RAVWlAVlkOp6xbFdgYfsGhZKLYsakmzOQPwwi5MN w0AvcT3axqj9FmaFmHocbnA5BiPKi2b25/69ipM6QAOD8tn+O5A4xeCkJ+yHSvKWipPG vrzMIAn4TMqY0w3+ybkINo/tokXqwln7qrKoJMIZmfzzzkv4VQDxU89/N21repy419mQ jblQ== 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=LYA4B4omJYzI63kHQ9zO0pbcqQ+j+dKm7W9AHudI/xE=; b=kVZcpKVWRzuOuNDBbJeJ1SqPMwS6htllwN87tz9MC1bON0ajfMx5akFRoK6r3zTj9T tMO+Vei/wzJ7MFanoREDLjsvjTOboszlbMFdxmrTlck/Kq18vjdM7kxNbb3EYi7XwQjC 41etKyfu0UeePlWVyksG3k1F4bMhHBzEJaTDmpHy6rhQiCYB3cB//S0yaIXmDXmEFJUM Rwe3dIWKvmqbSlMXSrZRz4kVjEY7rdS/jixSmAXhN+auAKhJhdVcNxkWZrflwbjI9sMe r/BRi0YRI5dWtUo9r5kgV5Cie92onFoSxvE8etHLDnFAw7AOqwc7N4faUeX3AxHsFXd2 PBqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=TFMKGem7; 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 c8si7899163edn.192.2020.04.27.05.11.31; Mon, 27 Apr 2020 05:11:55 -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=TFMKGem7; 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 S1727073AbgD0MJk (ORCPT + 99 others); Mon, 27 Apr 2020 08:09:40 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:10488 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726260AbgD0MJi (ORCPT ); Mon, 27 Apr 2020 08:09:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1587989379; x=1619525379; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=LYA4B4omJYzI63kHQ9zO0pbcqQ+j+dKm7W9AHudI/xE=; b=TFMKGem7/LI3b7aHzbhH+KImRKgBPtszmkn3Y2WI3QG22qnmoesGkslz 5S0ozO7E1VY+IvzhTCUqnSgkWY0cUqXMBU7WZRleiGyMi6wReWlMt9zkS s0nxChd3XCgHXk472VnddQ2M1S6lEXBuwr+S208UbVvIdkrqvDMfrpLmZ Q=; IronPort-SDR: LfLis/nt8cytRFcKjwrFEkRhuj7dpu1aRGlix9Wg0SOpyoRgZ4wlJkYpToZIpIWFvs84S831W9 4Wa6lznMBdSw== X-IronPort-AV: E=Sophos;i="5.73,324,1583193600"; d="scan'208";a="41099923" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2b-81e76b79.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 27 Apr 2020 12:09:37 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2b-81e76b79.us-west-2.amazon.com (Postfix) with ESMTPS id 1B0FAA07B7; Mon, 27 Apr 2020 12:09:34 +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, 27 Apr 2020 12:09:33 +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, 27 Apr 2020 12:09:18 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v9 10/15] mm/damon: Add tracepoints Date: Mon, 27 Apr 2020 14:04:37 +0200 Message-ID: <20200427120442.24179-11-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200427120442.24179-1-sjpark@amazon.com> References: <20200427120442.24179-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.53] X-ClientProxiedBy: EX13D34UWC004.ant.amazon.com (10.43.162.155) 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 --- 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 f810d0764840..6829b2d1166f 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); r->nr_accesses = 0; } } -- 2.17.1