From patchwork Tue Jan 28 09:01:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11353799 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 2F1C2112B for ; Tue, 28 Jan 2020 09:02:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EF80D24684 for ; Tue, 28 Jan 2020 09:02:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="SLW3zAsU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF80D24684 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 3DF216B0269; Tue, 28 Jan 2020 04:02:31 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3B46D6B026A; Tue, 28 Jan 2020 04:02:31 -0500 (EST) 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 27EAC6B026B; Tue, 28 Jan 2020 04:02:31 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id 11FB66B0269 for ; Tue, 28 Jan 2020 04:02:31 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id D5D634DBC for ; Tue, 28 Jan 2020 09:02:30 +0000 (UTC) X-FDA: 76426452060.09.fowl28_15de98ab9ef4a X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,prvs=289b61846=sjpark@amazon.com,:akpm@linux-foundation.org:sjpark@amazon.de:sj38.park@gmail.com:acme@kernel.org:amit@kernel.org:brendan.d.gregg@gmail.com:corbet@lwn.net:dwmw@amazon.com:mgorman@suse.de:rostedt@goodmis.org:kirill@shutemov.name:brendanhiggins@google.com:colin.king@canonical.com:minchan@kernel.org:vdavydov.dev@gmail.com:vdavydov@parallels.com::linux-doc@vger.kernel.org:linux-kernel@vger.kernel.org,RULES_HIT:30054:30064,0,RBL:207.171.184.29:@amazon.com:.lbl8.mailshell.net-62.18.0.100 66.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:24,LUA_SUMMARY:none X-HE-Tag: fowl28_15de98ab9ef4a X-Filterd-Recvd-Size: 5375 Received: from smtp-fw-9102.amazon.com (smtp-fw-9102.amazon.com [207.171.184.29]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Jan 2020 09:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1580202150; x=1611738150; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=z7C/S/RWP33ETPldsEhKusX9dKMog8aafhVgJAy6/Ys=; b=SLW3zAsU3HMKpoIWXYZqRiQXwAm7OpSUsCfpXufQXpwgGn2B7+iUkP9l RmmRRVhhnswdCzdwE91tq46nABb6mbD79V9CyxDkGY7JIVX7nguLu9Ec2 0Vj07VEDGB2Buw2vcqc5K14Kd7X5GIPuB3YRC1ArHquKggEnG8sGG1OQg c=; IronPort-SDR: 9IbQglGsP8lDNbxz6GabTwkO4rdA6M8SDdDzkkxvVIj2lx/AWmx60p/x4EjVlahdZHT8dh+tVt MRzMvC14RREw== X-IronPort-AV: E=Sophos;i="5.70,373,1574121600"; d="scan'208";a="21494898" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1a-807d4a99.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 28 Jan 2020 09:02:28 +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 E650AA17DE; Tue, 28 Jan 2020 09:02:22 +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.1236.3; Tue, 28 Jan 2020 09:02:22 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.161.176) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 28 Jan 2020 09:02:14 +0000 From: To: CC: SeongJae Park , , , , , , , , , , , , , , , , , Subject: [PATCH v2 9/9] mm/damon: Add a tracepoint for result buffer writing Date: Tue, 28 Jan 2020 10:01:58 +0100 Message-ID: <20200128090158.16234-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200128085742.14566-1-sjpark@amazon.com> References: <20200128085742.14566-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.161.176] X-ClientProxiedBy: EX13d09UWA004.ant.amazon.com (10.43.160.158) To EX13D31EUA001.ant.amazon.com (10.43.165.15) 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's result buffer writing. It is called for each writing of the DAMON results and print the result data. Therefore, it would be used to easily integrated with other tracepoint supporting tracers such as perf. Signed-off-by: SeongJae Park --- MAINTAINERS | 1 + include/trace/events/damon.h | 32 ++++++++++++++++++++++++++++++++ mm/damon.c | 4 ++++ 3 files changed, 37 insertions(+) create mode 100644 include/trace/events/damon.h diff --git a/MAINTAINERS b/MAINTAINERS index cb091bee16c7..b912c659833d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4619,6 +4619,7 @@ F: mm/damon.c F: mm/damon-test.h F: tools/damon/* F: Documentation/admin-guide/mm/data_access_monitor.rst +F: include/trace/events/damon.h DAVICOM FAST ETHERNET (DMFE) NETWORK DRIVER L: netdev@vger.kernel.org diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h new file mode 100644 index 000000000000..fb33993620ce --- /dev/null +++ b/include/trace/events/damon.h @@ -0,0 +1,32 @@ +/* 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_write_rbuf, + + TP_PROTO(void *buf, const ssize_t sz), + + TP_ARGS(buf, sz), + + TP_STRUCT__entry( + __dynamic_array(char, buf, sz) + ), + + TP_fast_assign( + memcpy(__get_dynamic_array(buf), buf, sz); + ), + + TP_printk("dat=%s", __print_hex(__get_dynamic_array(buf), + __get_dynamic_array_len(buf))) +); + +#endif /* _TRACE_DAMON_H */ + +/* This part must be outside protection */ +#include diff --git a/mm/damon.c b/mm/damon.c index f21968f079f0..6a0d560d38e7 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 @@ -19,6 +21,7 @@ #include #include #include +#include #define damon_get_task_struct(t) \ (get_pid_task(find_vpid(t->pid), PIDTYPE_PID)) @@ -587,6 +590,7 @@ static void damon_write_rbuf(void *data, ssize_t size) damon_flush_rbuffer(); memcpy(&damon_rbuf[damon_rbuf_offset], data, size); + trace_damon_write_rbuf(data, size); damon_rbuf_offset += size; }