Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3299989ybb; Mon, 6 Apr 2020 06:18:28 -0700 (PDT) X-Google-Smtp-Source: APiQypIR9RzLSYtdJ4APFc3AWGBykcUBUQHHkbrLGmCcczX4uc0yFo+d0NGkVA56mA2x/alN3LKX X-Received: by 2002:a9d:6d82:: with SMTP id x2mr18151958otp.50.1586179107928; Mon, 06 Apr 2020 06:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586179107; cv=none; d=google.com; s=arc-20160816; b=m7wpCY29LCUDV45fzaH4rSmoLteiNqStwRMKEtXhphGaKVd8+mbtZiJwoea4PfEdGW J0MshDC8NL5aNlSR7UekR/kKKJF6sp++4mOZAxJr4ErTlgoIgh79vk664GQciG8Zob+Z cQX4sG5UPWq6t1BKI+GqxiPgmOM/GI25zJ4LEMvN3ZhOvBVIE51yoPEgmVUGZKOV36kQ UTBn7tKGmFH8vH3SiwLWm9XOTmZVi6EHjwodsJ2mmoUJ3s/+4Ejh8aJb6G6tBm1tcqKz ikZSvMGWtNt7zPuU+qBsRhkkWu6urpBALEdZBb4i7pcz2lZyK95kvxltopl5xnAnvSP7 16KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:dkim-signature; bh=Bqx9bwtW2DodnT7nZ6v8smsi9CDUXdUuFOlLvH4J/6Y=; b=mv7EIw4ogV9hG4YhrwIea/XAcRZi3+RfC2vIYpo3YJeFVaPBNgZ048acm/vXp9vnjl /lYovKCPle1XfT8Fo7eBV432em+HC5+x99m/FuP8POpwQfL6zU7GieVF4RYQJm+pMdQN XHpET+Q8mIOsO8pTUTnQVfKBR3ijsvvKIQ+aD7BXdn7L+nsnWMXSUudbFC3v58lBvTfX tBbFMf3UVbBDdJsp4bV9Qydp3rGQZAp4BTzBkzNARePq0J6J42nh3YiwI9nHw6oLlir2 npDoET8doicw2Qo+Qvk4V5Ey3Si5n2Wn3ty+2pBx8EHyUWd/G25FKHdGTUfmP226RcCu En+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=uIwQUetn; 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 s4si7569370oom.84.2020.04.06.06.18.15; Mon, 06 Apr 2020 06:18:27 -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=uIwQUetn; 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 S1728380AbgDFNQb (ORCPT + 99 others); Mon, 6 Apr 2020 09:16:31 -0400 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:4761 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728262AbgDFNQb (ORCPT ); Mon, 6 Apr 2020 09:16:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1586178990; x=1617714990; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Bqx9bwtW2DodnT7nZ6v8smsi9CDUXdUuFOlLvH4J/6Y=; b=uIwQUetnjOR7OW6gtpSvNRBqYqLOx4xWLeYsxDI57hO2iqpcI3FnfLwD JttawdwBxJ5sdBtCoXaJ4QrlD20Dn8G+1hjD27mRfxMU/+1lEEdWNY1v3 CNoGMh6FPARgzEPWFnJ1mbO+KZd8SItmbxkZFKvSXdJralD4lT2o6FI+f s=; IronPort-SDR: SbuLSVIKH+9gdrgTLK8jxyTWOlc9rxLLbmpT3pADPIk0ipcA1nCt0RAGYEbvbpu99GkcRHtVFY yN6R3XQV53PA== X-IronPort-AV: E=Sophos;i="5.72,351,1580774400"; d="scan'208";a="24415376" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1e-a70de69e.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 06 Apr 2020 13:16:29 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1e-a70de69e.us-east-1.amazon.com (Postfix) with ESMTPS id F1D4BA2616; Mon, 6 Apr 2020 13:16:18 +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, 6 Apr 2020 13:16:18 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.65) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 6 Apr 2020 13:16:04 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v8 10/15] mm/damon: Add tracepoints Date: Mon, 6 Apr 2020 15:09:33 +0200 Message-ID: <20200406130938.14066-11-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200406130938.14066-1-sjpark@amazon.com> References: <20200406130938.14066-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.65] X-ClientProxiedBy: EX13D11UWB003.ant.amazon.com (10.43.161.206) 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 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 --- include/trace/events/damon.h | 43 ++++++++++++++++++++++++++++++++++++ mm/damon.c | 5 +++++ 2 files changed, 48 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..bec3501f2b05 --- /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 + +TRACE_EVENT(damon_aggregated, + + TP_PROTO(unsigned long pid, unsigned int nr_regions, + unsigned long vm_start, unsigned long vm_end, + unsigned int nr_accesses), + + TP_ARGS(pid, nr_regions, vm_start, vm_end, nr_accesses), + + TP_STRUCT__entry( + __field(unsigned long, 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 = pid; + __entry->nr_regions = nr_regions; + __entry->vm_start = vm_start; + __entry->vm_end = vm_end; + __entry->nr_accesses = nr_accesses; + ), + + TP_printk("pid=%lu 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 1712ce8a88a5..eb0dca2c899c 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)) @@ -654,6 +657,8 @@ 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->pid, nr, + r->vm_start, r->vm_end, r->nr_accesses); r->nr_accesses = 0; } } -- 2.17.1