Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp94360ybt; Mon, 6 Jul 2020 05:00:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqDDpd3dNRQkh4BzKBJ5TV4MEoIafd8nltxspOS3xFa1nYn6N16bhWq6lNvGlRzbEw30sR X-Received: by 2002:a50:e408:: with SMTP id d8mr53937949edm.375.1594036804833; Mon, 06 Jul 2020 05:00:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594036804; cv=none; d=google.com; s=arc-20160816; b=MU1mlczxMwI1avUtLGgPDVUWbjIV3BHiB7rZrAAv662u+PQ76KhCJLU4hCV+eUkGck F9qA7HuD6Nc6YIFz32ZC+eJSEKLEAYQ3f2f4IcfGt4V5cs4igS0ilaWCoUgvGkQIAnbv 6i+CPU3jbwJRh0dEviJcHXCuJTpkYEVjQ5qRIjFjJhFDpxrGfTWLJ2Gnhpct+VfA1Uwf BmhxRJARjNUh8SX3a8IwQRJcmZRGZxIpP18tJ0+shCk9rxL4IUd3aH1vjrZeomijqz7Y 4WjkqoJB2xG7wZzKE9FEnE5riTwTlxUmyQ1/j8LdJMEDCIKdxX6QxQvQHHUEC+J7wHIx 0e6Q== 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=GUogOMG40Gv5SR6Dd171JBML0s+hTwFfn6FBmFKxfsY=; b=BFy5DK375QJdk9IgK3tdY7kAu4n6NojqsDf0L41+Tuwnl2uwNjCCazsObywKHbFr+N qeYz1x+DXiW++ouE9BkTl09O7ulNt0IWhUEdI62ko7Z7ekgJKgSaq3l44W8ZaDHTRnky yoCwvfA6E5hpAWAD064+d9Xo5lXdTY9+7zxAIOidbH6i3pWyYA+ttCYmsQVNQhkGg0y/ cSL6xHTHpPmXySoCA1jYDFFsgjL/dimQHuBeYVSDRQUirIRfycoM0ifJe9OK5i6U9ABK AdzgpMI1UWag6uKkCiS0FfxfXwAOOH8SRfiLlDJE3aqVOWYL5lEESYgY27anr4q1pIeo IZeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=lrP7OqrQ; 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 y25si13081830edo.175.2020.07.06.04.59.38; Mon, 06 Jul 2020 05:00:04 -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=lrP7OqrQ; 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 S1729052AbgGFL4f (ORCPT + 99 others); Mon, 6 Jul 2020 07:56:35 -0400 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]:25147 "EHLO smtp-fw-9102.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729014AbgGFL4e (ORCPT ); Mon, 6 Jul 2020 07:56:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1594036594; x=1625572594; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=GUogOMG40Gv5SR6Dd171JBML0s+hTwFfn6FBmFKxfsY=; b=lrP7OqrQ4st8xdX+rgtKzZ7gGx/K213vbEuSO4q1q0iZDsU+iaqqZqE1 +WykYWFx4Q19lTmTsDUJ1GFOcmMXX7CLQvOYE2kmMY7vWTxVaLhv0U/Wj xMLil10oO5DpLcJTM4md7U3cA+CiOxlYEE08AqwHJmoYZAH10B7ZWyFmv g=; IronPort-SDR: RO6fbR9I1GKclWRAUE+MgsCrsf6S/Ioku6VWzTZMK/X2q3bI7nJsNz1Cpgi580+xn4cVYCfDn5 k61FoJUJXm6g== X-IronPort-AV: E=Sophos;i="5.75,318,1589241600"; d="scan'208";a="57624599" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2b-55156cd4.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 06 Jul 2020 11:56:33 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2b-55156cd4.us-west-2.amazon.com (Postfix) with ESMTPS id C37B7A1B2F; Mon, 6 Jul 2020 11:56:30 +0000 (UTC) Received: from EX13D31EUA004.ant.amazon.com (10.43.165.161) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 6 Jul 2020 11:56:30 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.100) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 6 Jul 2020 11:56:14 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v17 08/15] mm/damon: Add a tracepoint Date: Mon, 6 Jul 2020 13:53:15 +0200 Message-ID: <20200706115322.29598-9-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706115322.29598-1-sjpark@amazon.com> References: <20200706115322.29598-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.100] X-ClientProxiedBy: EX13D21UWA003.ant.amazon.com (10.43.160.184) To EX13D31EUA004.ant.amazon.com (10.43.165.161) 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 can easily integrated with tracepoints supporting tools such as perf. Signed-off-by: SeongJae Park Reviewed-by: Leonard Foerster --- include/trace/events/damon.h | 43 ++++++++++++++++++++++++++++++++++++ mm/damon.c | 4 ++++ 2 files changed, 47 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..40b249a28b30 --- /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 +#include + +TRACE_EVENT(damon_aggregated, + + TP_PROTO(struct damon_task *t, struct damon_region *r, + unsigned int nr_regions), + + TP_ARGS(t, r, nr_regions), + + TP_STRUCT__entry( + __field(int, pid) + __field(unsigned int, nr_regions) + __field(unsigned long, start) + __field(unsigned long, end) + __field(unsigned int, nr_accesses) + ), + + TP_fast_assign( + __entry->pid = t->pid; + __entry->nr_regions = nr_regions; + __entry->start = r->ar.start; + __entry->end = r->ar.end; + __entry->nr_accesses = r->nr_accesses; + ), + + TP_printk("pid=%d nr_regions=%u %lu-%lu: %u", __entry->pid, + __entry->nr_regions, __entry->start, + __entry->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 be8be4626400..ce351592fe86 100644 --- a/mm/damon.c +++ b/mm/damon.c @@ -19,6 +19,8 @@ #define pr_fmt(fmt) "damon: " fmt +#define CREATE_TRACE_POINTS + #include #include #include @@ -29,6 +31,7 @@ #include #include #include +#include /* Minimal region size. Every damon_region is aligned by this. */ #define MIN_REGION PAGE_SIZE @@ -791,6 +794,7 @@ static void kdamond_reset_aggregated(struct damon_ctx *c) damon_write_rbuf(c, &r->ar.end, sizeof(r->ar.end)); damon_write_rbuf(c, &r->nr_accesses, sizeof(r->nr_accesses)); + trace_damon_aggregated(t, r, nr); r->nr_accesses = 0; } } -- 2.17.1