Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp163481pxa; Tue, 4 Aug 2020 02:20:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw9XwKTHYLrmK0bXoBf6u+YxjZAhvnO6D3jZiCyoxnFlaD8N0M/CEv1Ml2JRuGpz1ZBxAr X-Received: by 2002:a17:907:7090:: with SMTP id yj16mr6388773ejb.73.1596532802288; Tue, 04 Aug 2020 02:20:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596532802; cv=none; d=google.com; s=arc-20160816; b=azaiiu5eknfDV7YaO33ZSZ17AOFcl11K1Wf8rFMC6um59NHhzcIOY37+YTYj1ANUSB 2p2p0KRlV1QpEiG58vxg58scT5RNT/A17nnUanARJwE66fyFMFNFgfQ7oKzjzFR80Bda YpzQzF2Td+Vqk4wS3yQn01gmuajFUfFBbI8Yf+wCggzZY6b4oV+9D0L/Epo9p2w8NfhD uX0miNz1CGdgwa51d6PtX0iCxnJnWbu/SVaIfjKWzHbM0dDKNdiLIdKpb7fFVjNfIKO5 SGlCO+nQGRL/IPYBmIRwthvj/lC1bi84XB8wD5ANdH9RvoLbWCfTijaxu5vKZpoBLBuV DG2Q== 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=KanOXBmrNsHYzBYB8gquHIKd6o9nbTmdI2Il5D6pxXw=; b=rIgfSvG7T6bjFY3bfGAtwzCtB6uW4/LjFKRNxsfWknV2uu2IgLLkXsbinqDiTsMLXQ YaGQPbDWeLxxT+bt/3ZO8vAtYzmuC4IVlqOmbbgZdH06NurfBZCHKwBYLRWc82V1N+P7 oOc0wSi+ORQZdnTQVL/FBUq4Kxqv3M6/tH4WaLStnYPXcP3QTTvwYuoIWT/0O9lUMjI9 9nAVP18mO9jTNJRMBG41JCfEoPXGAzTQc5Zef9kShh58PDXsa+U1oXJHjhIC0ub+42B9 B7GSh+jhXfh1rclSrO6DA0MHywtGXoIhUD9CUjWL5U8gsPBC8VjiiehI638FZVxguGkj NaaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=ZKEKPKlc; 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 lm15si8659652ejb.129.2020.08.04.02.19.40; Tue, 04 Aug 2020 02:20:02 -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=ZKEKPKlc; 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 S1729959AbgHDJRs (ORCPT + 99 others); Tue, 4 Aug 2020 05:17:48 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:2937 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727066AbgHDJRs (ORCPT ); Tue, 4 Aug 2020 05:17:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1596532666; x=1628068666; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=KanOXBmrNsHYzBYB8gquHIKd6o9nbTmdI2Il5D6pxXw=; b=ZKEKPKlcSVTzn97meTemEGxky4UB7gjCdRd6EXU6alvPt/o0T4luuPJg iYtSBg3ELLLM+2BQ2XqVc4V6WtrYihSYWc1TKKbF1gC6ap4DmCDjKtOcR 072U5RyOgr6fq5/97HU6rsFrJtYM2SvsoexGuszckTvMjon2hJUWWObj2 Y=; IronPort-SDR: 179l3hooCdAV+57V+BgCwul0XKf2B5bwb/zCLHJ1953UuS2Xjd5YU4LsefIm+8PpyCHYrHxHs0 G/7uZRxBLe1g== X-IronPort-AV: E=Sophos;i="5.75,433,1589241600"; d="scan'208";a="45900980" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-4ff6265a.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 04 Aug 2020 09:17:42 +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-4ff6265a.us-west-2.amazon.com (Postfix) with ESMTPS id 1BEAAA22DD; Tue, 4 Aug 2020 09:17:40 +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, 4 Aug 2020 09:17:39 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.162.248) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 4 Aug 2020 09:17:22 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v19 08/15] mm/damon: Add a tracepoint Date: Tue, 4 Aug 2020 11:14:09 +0200 Message-ID: <20200804091416.31039-9-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200804091416.31039-1-sjpark@amazon.com> References: <20200804091416.31039-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.248] X-ClientProxiedBy: EX13D36UWA004.ant.amazon.com (10.43.160.175) 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 --- 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 b3420ba97fd2..65e65e779313 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 @@ -856,6 +859,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