Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp603096ybh; Tue, 10 Mar 2020 05:00:07 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtPEupoqpX0yycopV1zHST4KhDCwu5dJUswgGsdZHopKVkF66PJQJUqYnc1t/Sdh80dJNbP X-Received: by 2002:a05:6830:204c:: with SMTP id f12mr16532164otp.356.1583841607325; Tue, 10 Mar 2020 05:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583841607; cv=none; d=google.com; s=arc-20160816; b=pX1zI2gBWNPfuMarKPGf0xZav/JwAChac+ZftoHvSQog1qCoOm2PW83lzYWWSli1cL jlV+AhVu96hzdV+QyXcg/C2e3OogSLV1U6HpCIhoPaOl5GmR+BiOzolxzV/W+vxm/UES Xb5A5HiIzTUz2SS7EDrNpsv4asFYsJeYsxEl+lkOBu796njsu7PdvindFraKNygw0w/d 5Y36sgebVoDr7CdSrmitzJ5fTmpV5rDP7Sf+XSm61scCKZQrMXA1fKBPgd9nDQ21Vmny fDXI2ODM2KmOLKTbhqb0NP6MQbh1XRVkx6fSc4gh7nHqDPtBzTLNZyKnMd1Wg2MF/moD lKgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:dkim-signature; bh=8PhEWrbLx4ftb154QoF0BF/Klh8/3U3Dc5cpOPWo/O0=; b=o4v19RzknzOryJ9J9q2OSvwIVvBuH738q4+kMdMMvYE9tD9slT26JtAkghZWffb2lv PkkVPi8OF8Oq3tzzJ8ulw29v7Y2LQOSPwvMIO4+FZEtBGHQCfSLJqOwbi3ug0xRqYvbU UJPj8Ja/qUJmy5WZ36skebmFwIud8lpPzSoCarpZaUnrdkjG2AyIzDnrodAYuuOQRBFS pzVarLjWNM/3n6VGuMxhhsqquejeEB8T1lCKP3kSDPfE0CtZYHkKz/J0ngb2amOgPBO2 5ggrHJOMyCchQDyuDACgCIFDQkYCgbw04g4v+RXG1hkf4BkJQ7heAIIryXBFxlvSHq18 YQCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=MSkVWomi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id z14si4987388oih.89.2020.03.10.04.59.56; Tue, 10 Mar 2020 05:00:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=MSkVWomi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726520AbgCJL6O (ORCPT + 99 others); Tue, 10 Mar 2020 07:58:14 -0400 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:46275 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726380AbgCJL6O (ORCPT ); Tue, 10 Mar 2020 07:58:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1583841493; x=1615377493; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=8PhEWrbLx4ftb154QoF0BF/Klh8/3U3Dc5cpOPWo/O0=; b=MSkVWomiCOPUhPyCq4le26nHHqrSJBJJ9r8MY5W4Mzclc6pfrHNM+bH3 YT+6nHb69bwFSgq0QajDvNtm06/uoIvSq1arzCu05VFmO0vPOv7nWhRDb RIhLNoA32UQtmkErOh4w8t5eOyICB/JhCZ6ER8KxrydtTjYo4wuzN2bO6 8=; IronPort-SDR: c+0tBTd9uIM/XjtIyW3WFpi2Q4aMZtL1Ry/AAz3NSDY6pKaJnNlVFhtz7/htTi2bVg2uAplV+A 4oI8MC87i2fA== X-IronPort-AV: E=Sophos;i="5.70,536,1574121600"; d="scan'208";a="21834230" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1e-62350142.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 10 Mar 2020 11:58:01 +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 4023FA29C9; Tue, 10 Mar 2020 11:57:51 +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, 10 Mar 2020 11:57:51 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.16) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 10 Mar 2020 11:57:39 +0000 From: SeongJae Park To: Jonathan Cameron CC: SeongJae Park , , "SeongJae Park" , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: Re: [PATCH v6 09/14] mm/damon: Add a tracepoint for result writing Date: Tue, 10 Mar 2020 12:57:24 +0100 Message-ID: <20200310115724.25152-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200310090331.00006596@Huawei.com> (raw) MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.16] X-ClientProxiedBy: EX13D03UWC002.ant.amazon.com (10.43.162.160) 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 On Tue, 10 Mar 2020 09:03:31 +0000 Jonathan Cameron wrote: > On Mon, 24 Feb 2020 13:30:42 +0100 > SeongJae Park wrote: > > > 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 > > I'm curious, why at the flush of rbuf rather than using a more structured trace > point for each of the writes into rbuf? > > Seems it would make more sense to have a tracepoint for each record write out. > Probably at the level of each task, though might be more elegant to do it at the > level of each region within a task and duplicate the header stuff. I was worried if the format changes, but agree your suggestion is the right way. Will change so in next spin. Thanks, 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 facb1d7f121b..8faf3879f99e 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) >