Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp916614ybs; Mon, 25 May 2020 02:28:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0iiX9nisldJASuQQsc9/N65bc4SrgfzfdQEhLluZIwFYn8ICpEuA8bTK2voeEpmqYdAlR X-Received: by 2002:a05:6402:687:: with SMTP id f7mr13662592edy.277.1590398915322; Mon, 25 May 2020 02:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590398915; cv=none; d=google.com; s=arc-20160816; b=wnz4n3oxPO1QHtDgdWPmH6bOF/nVIxzboy1Z5tTc6P17SkMTYLeWqobws3oUXAs+j5 SuBqezrrkWODJWweeN2c4xabgyKFlarJxE5mNYeXyPctV9iockZyzAps4iwsdHInW6US VAwPyZzurfQLijFekOxJaHe8Rfg6YG5BR1QeOYdeKGAk2JvB0FB0bwXsBvXvWsXj3XQu xeYG3yXIcB2gEA4t0IS0W+uBktJmH5UrCPd4P/92FTd6B5Ofh3wFhZw+eJDP3MRbKK2M zLnlVzSlBCZbESxnerS4XSFtxOvPZGNZDVz3zMih2kTwpXqzD52Sz81bTBvJocznVb10 ZMfQ== 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=zVjI3i2+dhnGOEXwONMPoVnhZIqxBYUTryjwXnjZ92o=; b=orjM3y+21R+pMxHEvuWIPwaRRAx5C7/JdWBXwXPCdISY+H7MZkY0ulBd08RZ/sBJlO W3QWtE+5d/XIaXTH0DgCz3VQX4GmxBXOHKtCkZQDQ9bpU3slxsGlRso1VRxobTbfvmic IKt2WxpbMCPelt5Hwg77VNrFuqDdZtFCj8gD8/v/yzXjTXYKKXVVdJpsOAz2FmYvN/Oh icM7W/RdVQJNdJrcrhSX3ekWrJTtnM/WuIVWrvNiJ96Riih5CjCfXmUuv3hqvL6Q54R6 YYoQUUj/i8wY+voyvSsV9o5aUC1EtgmnkJyUhsESE/suTkUOq0OJESOrhtjOMs0/g/mN Q+Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=Dtyb33nv; 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 k7si8272737edk.69.2020.05.25.02.28.12; Mon, 25 May 2020 02:28:35 -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=Dtyb33nv; 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 S2389406AbgEYJZe (ORCPT + 99 others); Mon, 25 May 2020 05:25:34 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:45437 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389105AbgEYJZd (ORCPT ); Mon, 25 May 2020 05:25:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1590398733; x=1621934733; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=zVjI3i2+dhnGOEXwONMPoVnhZIqxBYUTryjwXnjZ92o=; b=Dtyb33nvOvFqOkRLqMQvVkS54nfPnPvHtw4uDVASeB9jNHK+OeDC55xs 8H1kU0PnhpaOC7v0e9r0d92kgKBbRz5AvTMzzl1DjFadNqxB6U8PH2wpS ivJJ2Xt/lsKWVY4/AdiQGP+top1Kep/BpGQ9W871bLtIdqHShqKY3AEMX s=; IronPort-SDR: f2reFPtRKR57av5ouDglBzBLLmg49qo4jA3kjHxvIeTgaCZa1HVmpCx0AOO2c+LqF03JvDLUQ9 mNbECH8XqcYw== X-IronPort-AV: E=Sophos;i="5.73,432,1583193600"; d="scan'208";a="37415587" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1e-303d0b0e.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 25 May 2020 09:25:29 +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-303d0b0e.us-east-1.amazon.com (Postfix) with ESMTPS id A3FB1A21C7; Mon, 25 May 2020 09:25: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, 25 May 2020 09:25:17 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.90) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 25 May 2020 09:25:02 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v13 10/15] mm/damon: Add tracepoints Date: Mon, 25 May 2020 11:15:07 +0200 Message-ID: <20200525091512.30391-11-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525091512.30391-1-sjpark@amazon.com> References: <20200525091512.30391-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.90] X-ClientProxiedBy: EX13P01UWA002.ant.amazon.com (10.43.160.46) 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 6516246d054d..ffd011282c48 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