Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1841893ybk; Mon, 11 May 2020 05:43:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyA7ir0idUXQt4ylSiVih8yBvom75iu3YHtbDhze48NmlYoWCHyogWvYE9vFa2eov9LSfvz X-Received: by 2002:a17:906:a3d3:: with SMTP id ca19mr1210390ejb.320.1589200988203; Mon, 11 May 2020 05:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589200988; cv=none; d=google.com; s=arc-20160816; b=txmxVTU8yN/x1VwCTFGiZo9ls7VEVbRJIYwbryDp+6H9xIIkpWwFgQX+nTtQ+1YaOp El7We5oZhDiY54hkBpp21P+AIYXRPYo3CR7IbqXH+GhgrEOcFymIms0bwg2Z8Vrpwjls MbGJIsJkwG6BF8+bbB87IsrkXWyZkQAfnHU0gZBVB6L68FoP27lEhjbZckzj1u17JCei VpbLX98Fwhyw6+0YnYoCAgaaOB/b/qcd/QRpzbfqWOAu7g3b/xgr/Nqg7ru4lshfORsT fwBNhWYDfZGAW7McyLqO6QhYrDsfA9xl0wOvjrcBcp8snA1ZysuFTXGZETxCJdkCEbRN Znvw== 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=BvNLggfkO/fLiuS9ej6QJaMLUj9hxHuMBj6ADOC76Pk=; b=QuYZwcYSEVlHA55Rr/vTnPPNPcwhb6npNZsbbCNQmMAMxX6ZA6F9cLhIOmllyQQn7p RpmlG6iLUBF0Kp0dw2aVn1W5I7mu1ozYojBGnG2V3/BSE6fKxAhqtpRR799SO3xxIeKG XwAGbeuFWKEkYVp74PHsAdeYr+2r608x37pWyKHwqP4kja+J6hA+eGlphjoKbjlIR7lk hazcOt9Xnmn7YH1zaTUB3LkhwT/fRIr9ysFMa2eh4TNyZvGSXG0Re3+r5JjnqYakSI6F TvS0U8bfluf50DQxnZ07h2uEF6BZJT6I3RPB2prnwmwDN2f4kM5JkRj94HlgISAFcTA0 f6hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=Y8O0gren; 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 p9si5970730ejn.415.2020.05.11.05.42.42; Mon, 11 May 2020 05:43:08 -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=Y8O0gren; 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 S1729993AbgEKMks (ORCPT + 99 others); Mon, 11 May 2020 08:40:48 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:2116 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729596AbgEKMkr (ORCPT ); Mon, 11 May 2020 08:40:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1589200848; x=1620736848; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=BvNLggfkO/fLiuS9ej6QJaMLUj9hxHuMBj6ADOC76Pk=; b=Y8O0gren4DSsMXE+yDknbHNwAKXR39pQxA997+ZU/lVKg2iArmCDjnOo WHjP8E4YUQ4MlukvOGfHHpUTZ3sghKIrwc9XPUaHwE2TwTTKMbEmXLpzh 6UtcBzp4Ao7nD5n9+Oolxu9Ybo4W2AIsgnpU8ZMTNXslK3GH446vLI1rr s=; IronPort-SDR: jrDgV+Yx80uUS5LrhmVNeMRrFQkdd1AfWxgVBnvti196BZmoQjSIX7MbKozFx8XquUCGjtqCUe nBgwRfQ7lDVw== X-IronPort-AV: E=Sophos;i="5.73,380,1583193600"; d="scan'208";a="34196246" Received: from sea32-co-svc-lb4-vlan2.sea.corp.amazon.com (HELO email-inbound-relay-1e-57e1d233.us-east-1.amazon.com) ([10.47.23.34]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 11 May 2020 12:40:45 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1e-57e1d233.us-east-1.amazon.com (Postfix) with ESMTPS id C03BC14022D; Mon, 11 May 2020 12:40:33 +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, 11 May 2020 12:40:33 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.161.253) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 11 May 2020 12:40:17 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v11 11/16] mm/damon: Add tracepoints Date: Mon, 11 May 2020 14:32:57 +0200 Message-ID: <20200511123302.12520-12-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511123302.12520-1-sjpark@amazon.com> References: <20200511123302.12520-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.253] X-ClientProxiedBy: EX13D06UWC001.ant.amazon.com (10.43.162.91) 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 7a6525b708b6..ee117e920b39 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