From patchwork Mon Feb 10 14:52:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11373427 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 D8C26138D for ; Mon, 10 Feb 2020 14:52:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9C80F20714 for ; Mon, 10 Feb 2020 14:52:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="dd6IDxbi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C80F20714 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 E38136B010F; Mon, 10 Feb 2020 09:52:43 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E0FDF6B0111; Mon, 10 Feb 2020 09:52:43 -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 D4D636B0112; Mon, 10 Feb 2020 09:52:43 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0163.hostedemail.com [216.40.44.163]) by kanga.kvack.org (Postfix) with ESMTP id BD9696B010F for ; Mon, 10 Feb 2020 09:52:43 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 73A1A2DFC for ; Mon, 10 Feb 2020 14:52:43 +0000 (UTC) X-FDA: 76474509006.11.food13_34cfe09bd2005 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,prvs=302a421da=sjpark@amazon.com,:akpm@linux-foundation.org:sjpark@amazon.de:acme@kernel.org:alexander.shishkin@linux.intel.com:amit@kernel.org:brendan.d.gregg@gmail.com:brendanhiggins@google.com:cai@lca.pw:colin.king@canonical.com:corbet@lwn.net:dwmw@amazon.com:jolsa@redhat.com:kirill@shutemov.name:mark.rutland@arm.com:mgorman@suse.de:minchan@kernel.org:mingo@redhat.com:namhyung@kernel.org:peterz@infradead.org:rdunlap@infradead.org:rostedt@goodmis.org:sj38.park@gmail.com:vdavydov.dev@gmail.com::linux-doc@vger.kernel.org:linux-kernel@vger.kernel.org,RULES_HIT:30054:30064,0,RBL:72.21.196.25:@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:23,LUA_SUMMARY:none X-HE-Tag: food13_34cfe09bd2005 X-Filterd-Recvd-Size: 5185 Received: from smtp-fw-2101.amazon.com (smtp-fw-2101.amazon.com [72.21.196.25]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Feb 2020 14:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1581346363; x=1612882363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=sf7A0vfw3cQq8bhnPOhHviH9Sodji4zlA3P2YYS4bnM=; b=dd6IDxbiAwruWbOZWHCl/ny2JQe3JNirOnBtlh4VdU20GG8CyrvKSepw VzUSznk4XoeESB51iKfRcY1MsC+6Cys6+BsJWMzFaHOCgTkoDVmNi0Lvu YQENYX4ALPe0xl3Jut8wDfPkmMbJrwBaxKWXy4dLHoJ04BYmwYWeoRwsb w=; IronPort-SDR: frgHkJRMOFB8KaAC+ydJrMzf+Jit2A8V5ZGQDdePCRlnryGiuoKZTtj/aqka6umOxzdJUrlRIx n6EwplQIGy6g== X-IronPort-AV: E=Sophos;i="5.70,425,1574121600"; d="scan'208";a="16473270" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1e-62350142.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 10 Feb 2020 14:52:41 +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-62350142.us-east-1.amazon.com (Postfix) with ESMTPS id 53AF3A2331; Mon, 10 Feb 2020 14:52:34 +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; Mon, 10 Feb 2020 14:52:33 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.162.69) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 10 Feb 2020 14:52:21 +0000 From: To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 07/11] mm/damon: Add a tracepoint for result writing Date: Mon, 10 Feb 2020 15:52:06 +0100 Message-ID: <20200210145206.27950-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200210144812.26845-1-sjpark@amazon.com> References: <20200210144812.26845-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.162.69] X-ClientProxiedBy: EX13D27UWB004.ant.amazon.com (10.43.161.101) 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 --- include/trace/events/damon.h | 32 ++++++++++++++++++++++++++++++++ mm/damon.c | 4 ++++ 2 files changed, 36 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..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 748cd8537fee..02bfa12940ea 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 #define damon_get_task_struct(t) \ (get_pid_task(find_vpid(t->pid), PIDTYPE_PID)) @@ -553,6 +556,7 @@ static void damon_flush_rbuffer(struct damon_ctx *ctx) */ static void damon_write_rbuf(struct damon_ctx *ctx, void *data, ssize_t size) { + trace_damon_write_rbuf(data, size); if (!ctx->rbuf_len || !ctx->rbuf) return; if (ctx->rbuf_offset + size > ctx->rbuf_len)