From patchwork Mon Jun 8 11:40:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11593191 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1F43739 for ; Mon, 8 Jun 2020 11:47:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7488B20775 for ; Mon, 8 Jun 2020 11:47:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="IZsYSWSc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7488B20775 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B2FD96B0003; Mon, 8 Jun 2020 07:47:51 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AB8DC6B0005; Mon, 8 Jun 2020 07:47:51 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95A366B0008; Mon, 8 Jun 2020 07:47:51 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 7CF406B0003 for ; Mon, 8 Jun 2020 07:47:51 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 32648181ABE9D for ; Mon, 8 Jun 2020 11:47:51 +0000 (UTC) X-FDA: 76905870342.14.rail38_2703dd526db9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 08E0F1807C0B4 for ; Mon, 8 Jun 2020 11:47:51 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,prvs=421c5bd8b=sjpark@amazon.com,,RULES_HIT:30054:30056:30064,0,RBL:52.95.49.90:@amazon.com:.lbl8.mailshell.net-62.18.0.100 64.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: rail38_2703dd526db9 X-Filterd-Recvd-Size: 5985 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Mon, 8 Jun 2020 11:47:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1591616871; x=1623152871; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=kDSfYo/pEL2V4DC4paX/UN8Ve85oIzfba5PrIPdCZmY=; b=IZsYSWScAyU6oM6vdMpZWcgrni2OgY2yd7BExcwMk92Bx8zFvkDK8agS 1fTLBizEt44uuviO74NxB8bniNC1z+2AMo7OA+25c2bKWXknkG3GWNtaq ORcEEjM6S6NdIW7TBAsyCZfyLE+UIKD0vQGLsdW96jt/RrcbWs+J18L81 U=; IronPort-SDR: 5h4QT/qLHtN14Nctw3SJktE3UxI3R2i1nXt8bGuTi6hb0Er6OwiutJitKC1OTb3EIuQ8RWfeyi rt13MiJ68A/g== X-IronPort-AV: E=Sophos;i="5.73,487,1583193600"; d="scan'208";a="34926634" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1a-807d4a99.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 08 Jun 2020 11:47:50 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-807d4a99.us-east-1.amazon.com (Postfix) with ESMTPS id 7B779A229A; Mon, 8 Jun 2020 11:47:39 +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, 8 Jun 2020 11:47:38 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.162.53) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Jun 2020 11:47:21 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v15 09/14] mm/damon: Add tracepoints Date: Mon, 8 Jun 2020 13:40:42 +0200 Message-ID: <20200608114047.26589-10-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200608114047.26589-1-sjpark@amazon.com> References: <20200608114047.26589-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.162.53] X-ClientProxiedBy: EX13D46UWB004.ant.amazon.com (10.43.161.204) To EX13D31EUA001.ant.amazon.com (10.43.165.15) X-Rspamd-Queue-Id: 08E0F1807C0B4 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 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..fd260463d5b8 --- /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_task *t, struct damon_region *r, + unsigned int nr_regions), + + TP_ARGS(t, r, nr_regions), + + 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 = t->pid; + __entry->nr_regions = nr_regions; + __entry->vm_start = r->vm_start; + __entry->vm_end = r->vm_end; + __entry->nr_accesses = r->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 010806b7f92e..1ebf9af40499 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 @@ -762,6 +765,7 @@ 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, r, nr); r->nr_accesses = 0; } }