Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp533789ybh; Wed, 18 Mar 2020 04:37:14 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvjEMh+GZV880CWanmCIG5ZqalgyqBNFbf3ASC4PqidlGqrEKVnfeiKVwQB/YN0VJf7GWgb X-Received: by 2002:a05:6830:1d4f:: with SMTP id p15mr3251370oth.38.1584531434421; Wed, 18 Mar 2020 04:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584531434; cv=none; d=google.com; s=arc-20160816; b=Mxa3wIpqLBPIIi8vdmP6lRexbJIpeUFUHBSLa5WNuYURrgZfc4QGIbqb8YgvLS+XHD ripypPfAg4jJDwz2BhtV1mnf8CdOfi6bSuu3ElXq8h0tfa9G/P1jk7kyDI4GyNZN6O2H n/rfuES8h7UaaANPvw1PetHM9K0NduPjz9yDTmv27fL2PT8zUkXBnXecUz51Lk+6M4wG XCUNKdsgGGu+PbBKS4WUkrzdUrMNnISIixvyL2q5s/u9dx0qfQpMXnaeV4DHC4accmwi Nk5d1SdlWpHOndfwwNtcBmMqQ9Bx2RnoYlM3vZukeuC1KSvvQ7lSEkUAqo8DrD4iRU4f KcGw== 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=sUHB0hETKzB3vs3nYRu3gCYjEEmk+/WOhPjxLyr5pqo=; b=Y/5aDuKdg8c0U7eKGhEuI2eb6XsLycKnsklchTr8KUgA6K83koiHCJJAGNh4r6hLWe oaBzchUmsAJCpWg8cPzyMlJsIpCwH2HgzecjNQpEUVibuLVWnk/BAB+ziuX0o0TvA1A4 6C5C+VwJX8qVitR9pcdVDe7D0DSyeNYk6xwHJ2jcUvv3y/hpbrYZfoBZQ323LxdUJvRp HDLAL/MKrL6kiw4y7zZJRkdbbtRC1qKlwEAsu2xN47LLXIOUMPYePNtierxV4aZ6VzYE 3ul0l3WdOjQMyhgJxgIvMmeElWB2OWiMTspcWDq8Y+2lEylEepr7aPsdrV0sOZYxW1fx 912g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=BuZhRpAS; 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 o7si3275182otk.185.2020.03.18.04.36.55; Wed, 18 Mar 2020 04:37:14 -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=BuZhRpAS; 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 S1727150AbgCRLgb (ORCPT + 99 others); Wed, 18 Mar 2020 07:36:31 -0400 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]:44948 "EHLO smtp-fw-9102.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726989AbgCRLgb (ORCPT ); Wed, 18 Mar 2020 07:36:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1584531390; x=1616067390; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=sUHB0hETKzB3vs3nYRu3gCYjEEmk+/WOhPjxLyr5pqo=; b=BuZhRpASXoh57Zzlq+0lS/SoBhoIi5Owj/jvmrwQ+el7x77QAdVv73GA m+TuHJNQKI50CKPAfAX935tP6GQdsWUUURJrHL8hMTJdhZUaTshMg3gDO +3Ez5UgXNQOTe/LH5wqRWF49705r8SYmhy8XKZjHw5kI213QWr2qkEbAJ E=; IronPort-SDR: 0x6ulD+8FNaeOfzT9ajRGhcIi2hHvjRj1xp5k9N1i0mHxN3NqmiaUT4s6ziT1XUuNrI/+q3544 mGWH7++HChPg== X-IronPort-AV: E=Sophos;i="5.70,567,1574121600"; d="scan'208";a="31877214" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1e-c7c08562.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 18 Mar 2020 11:36:27 +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-c7c08562.us-east-1.amazon.com (Postfix) with ESMTPS id 3E0BD241327; Wed, 18 Mar 2020 11:36:15 +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; Wed, 18 Mar 2020 11:36:15 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.161.235) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 18 Mar 2020 11:36:00 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v7 10/15] mm/damon: Add tracepoints Date: Wed, 18 Mar 2020 12:27:17 +0100 Message-ID: <20200318112722.30143-11-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318112722.30143-1-sjpark@amazon.com> References: <20200318112722.30143-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.235] X-ClientProxiedBy: EX13D28UWC001.ant.amazon.com (10.43.162.166) 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 b77e537e2ffe..25c961fabdf4 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)) @@ -608,6 +611,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