Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3915585pxu; Tue, 20 Oct 2020 04:03:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1gLMgE/wovp9o2q9uLRih7PP0gxYHYz+3po7MI4YXvCtLVEfpgT6IjJU8A9B73BruxCdw X-Received: by 2002:a50:ab86:: with SMTP id u6mr2190382edc.158.1603191833550; Tue, 20 Oct 2020 04:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603191833; cv=none; d=google.com; s=arc-20160816; b=CV72fIATEfHCx0yZ4YK4MIy5ixDQ5Kwv8Wh+AHI2uReoM5gZoebg+b74XL6p2PUevH MXHkHZpNP2zhnT9EMyzl8oP2oDmg7wG4n/gElb3SZKy/0rcPJqR1D0Sf3ZuYUL/NaSsp 3ysaXkvWP0IWNLa911kOIoM90tf69KHepJUccWyicZUTBZYNhDYmTB6MmlwODMQrkwll TImuE3CYiXb469hRIez9FfYbgKffgvm0OOZ37hpq9l4ZQHrJQTjEFF3gxeXl0VuRKIA+ 4NbjSJsQ9974nzKRTlTWIiF5MEn16V8CHm3z2wDd2fKiHJl5O+8kvjy+A5HajIOJodUD XPBQ== 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=rWHwBW9odJPqpm8jQnNHAqv59PCTaiCF9pp/UZsKxQo=; b=qqVaozlF6MgkdRPUALvPJOmrgNEIM0bOip0VubRO2lFJdZG70Qm6yxdfN2hmFTs2lx 7l8PBbXj7BfShz4e6IPcjqwQUygqUXXDDSyuT5ZSzSpqN7GFEzfUy7/1nL7aPVFzWtiF 1lTkjQMMbzUzJZRSRbOnpu4yAcPdKKrcpKJWMtW65Uqr2NXnkTQWGSe6CigHSmtlrV/0 W3ZegLARV1+zTQdEYoMUPEivNCt9BgCbOhjq2ACiSNlISgl64uBXxtg62EVBd8SLaphF zHd4Pf5ysZK/34b++tclFloZWRMtS5z36ha/z3VEgO4BK834KlD5PBU9RvrJKA66y8U2 2b6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=BHyVqFxr; 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 dp4si924891ejc.117.2020.10.20.04.03.30; Tue, 20 Oct 2020 04:03:53 -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=BHyVqFxr; 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 S2392468AbgJTJIE (ORCPT + 99 others); Tue, 20 Oct 2020 05:08:04 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:61252 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730795AbgJTJIC (ORCPT ); Tue, 20 Oct 2020 05:08:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1603184882; x=1634720882; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=rWHwBW9odJPqpm8jQnNHAqv59PCTaiCF9pp/UZsKxQo=; b=BHyVqFxrImfayGNOGxttZeugWGZoujFYfBkN1VkR9BDHeCBGpVKdPq1m jmhVRp3JRF6dpstYscvGJ5U7TtpEUZjyzYBMKEbGX5EOuv5jfvvYbTMj/ a9I/B/L77wLV4Lbgp/xYGu19nvmmNDPPYTMQuZ4ELHDShW36fNJiFVR56 E=; X-IronPort-AV: E=Sophos;i="5.77,396,1596499200"; d="scan'208";a="78104561" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-538b0bfb.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 20 Oct 2020 09:08:01 +0000 Received: from EX13D31EUB001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2a-538b0bfb.us-west-2.amazon.com (Postfix) with ESMTPS id EEB06A180E; Tue, 20 Oct 2020 09:04:48 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.161.237) by EX13D31EUB001.ant.amazon.com (10.43.166.210) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 20 Oct 2020 09:04:24 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v22 09/18] mm/damon: Add a tracepoint Date: Tue, 20 Oct 2020 10:59:31 +0200 Message-ID: <20201020085940.13875-10-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201020085940.13875-1-sjpark@amazon.com> References: <20201020085940.13875-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.237] X-ClientProxiedBy: EX13D41UWC001.ant.amazon.com (10.43.162.107) To EX13D31EUB001.ant.amazon.com (10.43.166.210) 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 36428327e848..d7957d8ff530 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -13,6 +13,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + /* Minimal region size. Every damon_region is aligned by this. */ #define MIN_REGION PAGE_SIZE @@ -386,8 +389,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