From patchwork Tue Feb 4 06:23:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11364083 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 2041514B4 for ; Tue, 4 Feb 2020 06:24:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E069D2166E for ; Tue, 4 Feb 2020 06:24:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="usojpGLL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E069D2166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 17ED26B000D; Tue, 4 Feb 2020 01:24:25 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0E2156B000E; Tue, 4 Feb 2020 01:24:25 -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 F12906B0010; Tue, 4 Feb 2020 01:24:24 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0112.hostedemail.com [216.40.44.112]) by kanga.kvack.org (Postfix) with ESMTP id DBC286B000D for ; Tue, 4 Feb 2020 01:24:24 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9EF7D1F1B for ; Tue, 4 Feb 2020 06:24:24 +0000 (UTC) X-FDA: 76451455248.02.hope43_438bf9e402d51 X-Spam-Summary: 2,0,0,c8404057411d2323,d41d8cd98f00b204,sj38.park@gmail.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:41:355:379:541:800:960:973:988:989:1260:1345:1359:1434:1437:1535:1542:1711:1730:1747:1777:1792:2393:2559:2562:2897:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3871:3872:4250:4321:4605:5007:6119:6261:6653:6742:6743:7576:8603:8957:9413:10004:11026:11473:11657:11658:11914:12043:12291:12296:12297:12438:12517:12519:12555:12679:12683:12895:12986:13161:13229:14110:14181:14394:147 21:21080 X-HE-Tag: hope43_438bf9e402d51 X-Filterd-Recvd-Size: 5552 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Tue, 4 Feb 2020 06:24:24 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id j4so9144622pgi.1 for ; Mon, 03 Feb 2020 22:24:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Kgwt3mvUxDF/4h5A6PO11Mgg+qixlsRKZ7kH5hXHtOE=; b=usojpGLLj57Z3wvu2mPCgoKTiJrkEIIGLCb+lCdufsX39ROV1cpGt0BrxFzldX7piK 69KYY/OKR14AEUECwXDl9fwl6M5lbWVuk6K0YLcjp7z27uzl7b40leLw1nT88JQU4BJt BOiA9t5WK4qD6jS+MDypjUwLaMjB7GX3aTFvA8bWRTdZ4KDSLX6p+hMcTgZgeU31qXjb 7DLDnpLl3xqLt/kIiuk2lGUnzPHGZS071MUFHWEHODFSrBzTA4e677xNmEvW3+w+pxlY MfuCIyXbARgyVPAAAWv7eUbVwjnCfgmRAbVnj1v3xxrOZyfaUFVsraxW3u2A4Mq4raSS pcZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Kgwt3mvUxDF/4h5A6PO11Mgg+qixlsRKZ7kH5hXHtOE=; b=bGAPP9Tmk29h4QnryZ1ArnP+L9tseBPP4kEhACg46p+0qUbcNuYvezt2yWLGr2Vakn GZHUOihGHGaHstuhhxAjCuX1XHxI1pzjtjyD9OSPaa+8IkLj5SD4dNu2g4swzeR47h8H Y4A8V9epjR2oHB03PDP3fuY3Cq9sSfce7aNwPhnWfsLkIfvKCgeHiX3ORH7F9b22RmpX FTnt2jxPsWnzH2D48a/a4wRE2e3cpejDwQyOWK8t+mEAA/7Lt9w1LxD7Lg4R2V9B6dTs 7QxF23XsvM23Oc9G7ylAb6gCPe/OGDXOwu9RowpBwpIvHj7wwwjlXBKFKK5UqCMr+G+L Uyqw== X-Gm-Message-State: APjAAAXqClxvtEMRQYJpY1u3SntwBOs7fNMdCGAqISwVF7BgEf7xgzmx hlXKABXKKAauk4TN13GoHy8= X-Google-Smtp-Source: APXvYqye5zn8oWPNMoqgG54z3RMcKwJ+WnAZWJRv0bFoDAjW2POnyjov/s7WAlqBAsIgAe47CwAOQQ== X-Received: by 2002:a63:3487:: with SMTP id b129mr29614510pga.320.1580797463177; Mon, 03 Feb 2020 22:24:23 -0800 (PST) Received: from localhost.localdomain ([106.254.212.20]) by smtp.gmail.com with ESMTPSA id u26sm21880240pfn.46.2020.02.03.22.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2020 22:24:22 -0800 (PST) From: sj38.park@gmail.com To: akpm@linux-foundation.org Cc: SeongJae Park , 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-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 07/11] mm/damon: Add a tracepoint for result writing Date: Tue, 4 Feb 2020 06:23:08 +0000 Message-Id: <20200204062312.19913-8-sj38.park@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200204062312.19913-1-sj38.park@gmail.com> References: <20200204062312.19913-1-sj38.park@gmail.com> 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 f1d7200f3936..c2a098843936 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)