Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1287730ybg; Tue, 2 Jun 2020 06:17:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1yfdYrvYTPOIuzBAA2nT697y84KrAszuEW0OdmI1eSuOHh/DFY5BMFgXKpHe5iObpSb58 X-Received: by 2002:a17:906:17d1:: with SMTP id u17mr23111052eje.242.1591103864960; Tue, 02 Jun 2020 06:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591103864; cv=none; d=google.com; s=arc-20160816; b=KQTlp8TCPwodkVEg88cZG/cACB5te+yPBIdAwX6deOKSHIC8qQ2NJFs8WiCjQ1NpaP lzI9k6Hxex8gAdSsc+1y2nJcM9mLjhnRlKjzb8SgEUP+MsYA8ZLt2uqm6F4qAVa3Whs5 6T6hyYIdKE/HeUVIVKc4QXyH+xv/5uvwfth3nl6C+PFymSpdehEbK9/XLg79HotBHJPZ 7BHCXBYPCWSds34fcssmF5B0TBMf7d6H8sAFC9onJs73mo9GilWoVeJDZ8fPqi0VPy/v 2REAZyZq3jK5s8XAZ6+LstP4DA/P/ukseScp30xDHhRMpOIc3gJUCIs7SAm1g3rD2HfD ioUg== 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=8JGBy8gZAjCRLD5i3p6YmN4Jl57pC+5KaEYiBGwvMNo=; b=b04eT7IMAIifnS5H6uj2hypATcY6nL1U13/8c9w67AaZIjNyj+5Lg+w09yPpkRfo0M pR7z28RkF5EUnnT/jEYykxiqbA0pQh5ZmdGjiwfR8tHfMKGc1SckAlT1w0ZWI+nOzU88 /achYkttKfGyt+jc9bVmAdnrtjjOiH0CRff/l2ESracPE7rVsFQfFEGeZrMDK6kM41ip 4ZTsIsGkAUYzVbjkaxI5sZfzgjsJnocRbgFTvk11BF6WpORyYmfeQ64c9HbHdJKDD3lu UXjwylz6PuDEuUfZRqChpXkoWSlz2WrpnYPlGeglpVA7VRnu+04tIVRxQ1fRU0UyZO3s eOnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=VnR9flOF; 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 a99si1539355edf.381.2020.06.02.06.17.21; Tue, 02 Jun 2020 06:17:44 -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=VnR9flOF; 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 S1726342AbgFBNN3 (ORCPT + 99 others); Tue, 2 Jun 2020 09:13:29 -0400 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:52091 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgFBNN3 (ORCPT ); Tue, 2 Jun 2020 09:13:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1591103608; x=1622639608; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=8JGBy8gZAjCRLD5i3p6YmN4Jl57pC+5KaEYiBGwvMNo=; b=VnR9flOFu3zjishZ5hRq91O80l4qhJu+SBjN3PdUC7b3KCkdJKIbNpmj ChHtT3WckiprnF6aKoSIT0vZWbRsj6ZtPtdLA+nbXoC3ADbLifC5O5izX rB1qpsoYx1NisN3ovnTvjvWDaL1K6h9+kLKAtEVadzohBlTO8OeRMEC0Q k=; IronPort-SDR: Ouvqh5524HgVpj23Vpn6Kc8yqAW9izadPSzizcDGx/+pzeLsG47GLEtR3CAT7DLTQvd77enBhw 5/zLzrvJR/BA== X-IronPort-AV: E=Sophos;i="5.73,464,1583193600"; d="scan'208";a="33962858" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2a-6e2fc477.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 02 Jun 2020 13:13:24 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-6e2fc477.us-west-2.amazon.com (Postfix) with ESMTPS id 8588FA1DAF; Tue, 2 Jun 2020 13:13:22 +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; Tue, 2 Jun 2020 13:13:21 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.48) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 2 Jun 2020 13:13:05 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 09/15] mm/damon: Add tracepoints Date: Tue, 2 Jun 2020 15:12:49 +0200 Message-ID: <20200602131249.22765-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200602130125.20467-1-sjpark@amazon.com> References: <20200602130125.20467-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.48] X-ClientProxiedBy: EX13D41UWB002.ant.amazon.com (10.43.161.109) 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 | 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 6b0b8f21a6c6..af6f395fe06c 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