Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2597523ybk; Mon, 18 May 2020 03:13:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcw00a8ibtquqJ0iMPV4Fr/XSS9kvMalk+vXobgzu4kYLejp7F9HKLCnR9da01LxGTR4YD X-Received: by 2002:a50:98a2:: with SMTP id j31mr12408241edb.79.1589796806871; Mon, 18 May 2020 03:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589796806; cv=none; d=google.com; s=arc-20160816; b=yYfX2dKjQnYy6ftKuWfqo41m1RV67w7lZNdUEwfUyilIGbZ5FygvY8ieLls0Z0S+cM wjt9+iTdGc45ipa6X3XPf7OaP+mwurxZqLkNPcE2Z2JiPsWPAeqxE3ux/+Lexbzx89Rz cMu5Y5pegeqJP2d12LIvaAMGA2q0qHAFc2eC62V5DN2ND+JRFmBzjnVL7z1sHJk2qdHE o/2h2izeivrptICX1vwf2tyUIQaTWGGmqm2IcN1xwbf2mG2BtKyjUG7IpM6SjwV9n546 BGSkm3x6I/p5aVMAgBIQCypQ4kAbFNBsYJzNXLMpoxIFaVVwwpzbPeBJ0rivJFw3tqRh UsCg== 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=dJEekujnlVmUwvZjfeZC3dO79w6fIJD4Xir1b7LUML4=; b=efVXfFn8ZPHVJWyhIyf7CJ5SqGELCh3GWQCHr6p2Gc4unogfqxTOu0kP62I0E4sBu9 HwwsKd0UR3hEfDO34kcQNK4plZsW0akuzrSaKs9qKlyAYYYBi4riTHgX75U+PKWCTb2R DuukHoVAnyV6H96iPRVYidSghwkQSR21JoqFU7XkOZt63NJYi6Drf5snBwD1mXUf6zYq paueOetv5IAX2Nu5pGWv5fVY93gQvk1J8KF1i014chNOY2Ax1VfMC60rAzLavX08VWp+ Er+FljPxaqH48YL4ah6xe1+xPd8wTAIy5ypkrChxQN2QPfozqcy7S0Iw2MV4DJlAl3iS z7dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=TuRAwcR2; 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 gv8si6061169ejb.530.2020.05.18.03.13.04; Mon, 18 May 2020 03:13:26 -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=TuRAwcR2; 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 S1726557AbgERKJ1 (ORCPT + 99 others); Mon, 18 May 2020 06:09:27 -0400 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:53978 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbgERKJ0 (ORCPT ); Mon, 18 May 2020 06:09:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1589796567; x=1621332567; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=dJEekujnlVmUwvZjfeZC3dO79w6fIJD4Xir1b7LUML4=; b=TuRAwcR2VTcHfRCPSwpH3WrlQAUWwHaJMhhlH0u1TTP0x3bZHHCmiBem 6+xjihJ8WixK0dWoQuPSnQ+Vxswc96jHDvGOw/+oCTiHpxmWctVY6VujP pBWNU7sEchv2dqfmrB2i/uhohBtSea1YaOz8qPxQcN02kC+mife50NVxj Q=; IronPort-SDR: 7DjifG9wA3s1/1dCSl7vVQCbzgm2YFTyJInCWgQXDLDGab6Fij5OmaIGFomTJ5d18eX3lz8eq2 NATWr5fbVsOg== X-IronPort-AV: E=Sophos;i="5.73,406,1583193600"; d="scan'208";a="30821879" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 18 May 2020 10:09:26 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id 94334A1B85; Mon, 18 May 2020 10:09:14 +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, 18 May 2020 10:09:13 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.90) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 18 May 2020 10:08:58 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 11/16] mm/damon: Add tracepoints Date: Mon, 18 May 2020 12:00:13 +0200 Message-ID: <20200518100018.2293-12-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200518100018.2293-1-sjpark@amazon.com> References: <20200518100018.2293-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.90] X-ClientProxiedBy: EX13D04UWA003.ant.amazon.com (10.43.160.212) 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 f31310536c79..6fd55aec5275 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