Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1559631pxb; Thu, 4 Feb 2021 16:49:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfFW/9x5knU4341DQjNCCTn97khf8xWH1TEBOAGwDB7r0uPQ/yX99qYWhq8PNd5tXpINjn X-Received: by 2002:a17:906:547:: with SMTP id k7mr1596926eja.273.1612486163972; Thu, 04 Feb 2021 16:49:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612486163; cv=none; d=google.com; s=arc-20160816; b=S0wszL1fvx20eh2ZJMXaZ3CuHDhQ/IvecaeJ//q4pec104Y2eNVaF8jcYSZ0UK4/Ap vdvyrO4eWbBQ+dvSfNAA5ZDRjWy7qZDNb1uOe/Sd1FD0+78pdF1WrpNj96mIGS7ehx2y j7K6aGxIDKME8Gc0iK15HwWJVHGq0czoMoMCJO1ekHNASg/8k9IMRjCkxmFHL4bjM8cH 55/lPIbz4v0vBZOazDqRnlgPLIfSPhquEkFnM2BDnQJ2B3WY0XhPVUy0jgx+rO1TrTTw ADCJoWnaUWa08Bqsp1RRSB9edJfg7xrvAHcP8rdQGLgj7guxQIg38g4ws93+8Ig3Quef 9cEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CvzI94r9LiC7RH+dtcaRZqda/Y720VadPnKc/47pvNM=; b=S3xdLSdkEqteWz3DGSjWiiyEzYQN8u9YhVblj2AHoV/7E3o7zpcvKWdPpHbCuDkJfm dq5DiFfC7YPsTJYxRELeW/tXUS6XGplaFT1t5UZQvocrK4fg9pV4KXFgXGsvkVLo5ash UaiYAODoJ6qq7ARh/5fG78yebjWN1dojLc0U0EZ6AK5oDJCyVRQvYRPXEM3Rh0un/8a6 XWgz80VMLLmv/kgIhjXN9Q0oNjqo/FoQ0Tc7Ju6LQ/nPZ/gRVonNcPjHE3w7pwJaAkeD J6ZPBRNs4Cy2LCFwOFCV1LhaXRhd4u7QnZek8/9Z6WkzXoA4r/IDrJ0E/xu8Te+WgIk3 IAUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=AwOdrOsF; 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 dr8si1096552ejc.138.2021.02.04.16.48.53; Thu, 04 Feb 2021 16:49:23 -0800 (PST) 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=AwOdrOsF; 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 S237456AbhBDPiR (ORCPT + 99 others); Thu, 4 Feb 2021 10:38:17 -0500 Received: from smtp-fw-9103.amazon.com ([207.171.188.200]:26502 "EHLO smtp-fw-9103.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237318AbhBDPfP (ORCPT ); Thu, 4 Feb 2021 10:35:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1612452914; x=1643988914; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=CvzI94r9LiC7RH+dtcaRZqda/Y720VadPnKc/47pvNM=; b=AwOdrOsFbDspLgCjiFl1ydK9q0HC0iiXNwRHVIJgQlo0YD0na0ms5WyZ A90OkPawcLG1IJ4IAYVhSAwlPiVC5ieJMeTEVjVuOxuwbmZFVPxdOlfo6 drzM6bpT3EtiggcU0h3zZH76fYeOsf7lV1R9/VPWIbUi3nLngOO9WO/1A Y=; X-IronPort-AV: E=Sophos;i="5.79,401,1602547200"; d="scan'208";a="915636034" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1d-474bcd9f.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9103.sea19.amazon.com with ESMTP; 04 Feb 2021 15:34:23 +0000 Received: from EX13D31EUA001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan2.iad.amazon.com [10.40.163.34]) by email-inbound-relay-1d-474bcd9f.us-east-1.amazon.com (Postfix) with ESMTPS id 51FF6A1D33; Thu, 4 Feb 2021 15:34:12 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.161.146) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Feb 2021 15:33:55 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v24 06/14] mm/damon: Add a tracepoint Date: Thu, 4 Feb 2021 16:31:42 +0100 Message-ID: <20210204153150.15948-7-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210204153150.15948-1-sjpark@amazon.com> References: <20210204153150.15948-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.146] X-ClientProxiedBy: EX13D18UWA001.ant.amazon.com (10.43.160.11) To EX13D31EUA001.ant.amazon.com (10.43.165.15) 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/core.c | 7 +++++- 2 files changed, 49 insertions(+), 1 deletion(-) 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/core.c b/mm/damon/core.c index b36b6bdd94e2..912112662d0c 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -13,6 +13,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + /* Get a random number in [l, r) */ #define damon_rand(l, r) (l + prandom_u32_max(r - l)) @@ -388,8 +391,10 @@ static void kdamond_reset_aggregated(struct damon_ctx *c) damon_for_each_target(t, c) { struct damon_region *r; - damon_for_each_region(r, t) + damon_for_each_region(r, t) { + trace_damon_aggregated(t, r, damon_nr_regions(t)); r->nr_accesses = 0; + } } } -- 2.17.1