Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp582232ybj; Tue, 5 May 2020 04:16:31 -0700 (PDT) X-Google-Smtp-Source: APiQypJnQ6K3q1w/kWAs+vIUqkG15xCkTwzXXAeYWOolkHVsbPmY1j3dnsLHHAgBhKaVcHrWhxvM X-Received: by 2002:a17:906:2511:: with SMTP id i17mr2133719ejb.165.1588677391434; Tue, 05 May 2020 04:16:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588677391; cv=none; d=google.com; s=arc-20160816; b=IWvrZaioCZ7ThUrxtO/mPIaZUeg5lnxG30nSx9X7KBB1QVZPBy3zSJR1gO872WmhEF 1KFL+0zKeaHlTijcT4X7Bj+Zmy75k1v6VZsRTWMRUaOBx0of1gtSNgoR4uKqY1jKXC30 odzZYXCwcAmsMpNEBuPhpkNTTV6QLFx1qpefe9wrTH6LYgwrikrKDQMSkuQrb4nUL3sy u25elWea1QA95anfOUdju4n+vUCzNXPKcblsQBq0Jdgc3Ll+Mdz/zLtPDRXtGWniVIVB z8xJ6KyRIS1PzUWxM+vB0/A7vt9AaJzGxGA1xGxWdfD7rIhgltrEnxCM1Ch9sJou+nyF LWxQ== 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=Pt3cBmLZtE7h5ESUFNNHWoRiq0k+KQ57tz4K9OQ7T3w=; b=cvwuA2fFIRAsxi2/LBt4yB1lm4szF5biW41RYZ0TZ0jvNscmVmuFu7iAkE/R4Tv2RI YxfGrWXmmoh20xFQt7LLetuUmOgvOPi8eYAcyBrzoFUCWvzs4nu+sswnT5aVNFbW/YN5 1rcxEcr6D+xxF0jES2ynKRttAJZlbaybHLzcdMAId9pW+2wEVZwzj6kKQp4UjRQ++yww Aj0q0bQQqU8u09CPLshxp00AiqdYVdCvm/Obx5XzGL48+3WcTOirfymoF074Pz3moMzr 941XJ6EIifax4y2zMUcfuMCZrAGL/hjMbmXwsKUb8Zd5BR08VPUTxzudOELt35daT7YU nYwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=bcLfITJo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dk4si850992ejb.529.2020.05.05.04.16.08; Tue, 05 May 2020 04:16:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=bcLfITJo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728917AbgEELNo (ORCPT + 99 others); Tue, 5 May 2020 07:13:44 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:4735 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbgEELNo (ORCPT ); Tue, 5 May 2020 07:13:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1588677223; x=1620213223; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Pt3cBmLZtE7h5ESUFNNHWoRiq0k+KQ57tz4K9OQ7T3w=; b=bcLfITJoxsrFA5ThfE6jz7Bp/cgUZcibGqQNQcuIX7ZCTImtN7zFCU7K EfLY4i/5cKuPqr0w2K2jIFfCVOhNGK+48T3ZMt01d7szVwnmATlqMOPzn OKEQK5qTP0+uZpcPuOaMRCVkAF9Sre6LISntS5f5yDN6xErx3SzoTGe5W Q=; IronPort-SDR: tuN0FVbulAJQEmVCRkXD7YZg7eKecF3wLQ+nWlaDDSTPEB7Y34yOPdhG06uiWHMVduTjvy7e/D rrb5bo2wX2Yg== X-IronPort-AV: E=Sophos;i="5.73,354,1583193600"; d="scan'208";a="28673540" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2a-e7be2041.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 05 May 2020 11:13:40 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-e7be2041.us-west-2.amazon.com (Postfix) with ESMTPS id CAE60A2784; Tue, 5 May 2020 11:13:37 +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; Tue, 5 May 2020 11:13:37 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.92) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 5 May 2020 11:13:21 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 11/16] mm/damon: Add tracepoints Date: Tue, 5 May 2020 13:08:10 +0200 Message-ID: <20200505110815.10532-12-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200505110815.10532-1-sjpark@amazon.com> References: <20200505110815.10532-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.92] X-ClientProxiedBy: EX13D35UWB004.ant.amazon.com (10.43.161.230) 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..22236642d366 --- /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(int 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(int, 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=%d 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 fac56448847f..9f7d173eca3b 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 /* Minimal region size. Every damon_region is aligned by this. */ #define MIN_REGION PAGE_SIZE @@ -650,6 +653,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