From patchwork Tue Sep 12 18:35:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13382028 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 757D2EE3F0D for ; Tue, 12 Sep 2023 18:36:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E4536B013D; Tue, 12 Sep 2023 14:36:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F3866B0145; Tue, 12 Sep 2023 14:36:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57E586B0140; Tue, 12 Sep 2023 14:36:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3D1AE6B013E for ; Tue, 12 Sep 2023 14:36:07 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 14AC012096F for ; Tue, 12 Sep 2023 18:36:07 +0000 (UTC) X-FDA: 81228799974.20.1B424D1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 6784218001F for ; Tue, 12 Sep 2023 18:36:05 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bOqHbiv4; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf06.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694543765; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=br6RxcKd/TjTkbpaCnmw6891aLjmucVBm8/AaQUAbqY=; b=qB+01cQub8DY8qJ2VifxvVjCjaRygmghaUaX8Hky1IOtsMayENKay6U7TQgy7JcmnprPdj ijLh4heBHaCyjpEHV2Z2ZKA//DJCd/EjvOlo8NMMO1x4QNE9AypHNm0s/RLABijYp4xh69 UoNhOj5STjmTC2pdPjZ5C7GIjvGeZro= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bOqHbiv4; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf06.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694543765; a=rsa-sha256; cv=none; b=eAxBtk9Jfukknn/y4JneFmByxsvcz4xKCXLpKOecKRL9Md8LwwxY4F9XEIDzLRn1jAeigX jIrPfn0pDHQs354BxaTJ9GZz3jj/2201H2C6zI4b0TmXRMt5M+3UgWwEX2/jUwNejOJsB0 QMw6ftc7MwrBNb65mFcJNdQvIuVMfUk= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 83089616DD; Tue, 12 Sep 2023 18:36:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED624C433C8; Tue, 12 Sep 2023 18:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694543763; bh=Ux09g9gvrxiM7e96gBaO1VxVbWHC7sVtSUZj+woij6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bOqHbiv48YSWBMbvRN6vZU8YWfJ0YC6DosroZx3A9M/67BNe2s8yE+t+ld33U9+Ed yKQ0j/iIsfTFVUpjQceMWRN4+KJ+yGz/oPfLgYD6T7ESKSy57+wsRBHH/D0fIXWTrg mWwQH0/AviNOCk2et9ZKEZcf2sXer7c4xxzOofCwPLg75IkVptfYLTPbnEJVn4oBxV d+0ZMia0W2b3jC6/BO5wmTuxhh14bR8DrpKf43skAtdrDpMqSa/HBGML5WUkthZEAZ FqfnnIUKGKUKFyRSeTuR8eX6JU0ttzoub0B6fA3D9F0k9pTKpYsUBWMQNRWsPpmF8S 0qU87pY7zDxTg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Steven Rostedt , damon@lists.linux.dev, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] mm/damon/core: add a tracepoint for damos apply target regions Date: Tue, 12 Sep 2023 18:35:58 +0000 Message-Id: <20230912183559.4733-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230912183559.4733-1-sj@kernel.org> References: <20230912183559.4733-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 6784218001F X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: fs8fhhf8hgd4ia844hz8y7iro9r8ethy X-HE-Tag: 1694543765-109370 X-HE-Meta: U2FsdGVkX18LPWiaH/epBxxtYC3udylPxXwZAPEkGiDwdQBT4M0s0DhBwQQBht8n7XSp07jBxrogVB0ynFwAbdwdFmnQeSsRlxdwQ/3TDMbtwRao0CVZCUvtIIlb48yHh4+er4Mus9Ua5ZGELSZ9CwRlLPQTg7L2Qr9inT9GGQ2jkNpCycZtpqIpqwjBhBmqAmaosoYk2ArXGmUIzFn+XkHgF8tRiR9vYSyO2a4f6Asu5n473+VWXqOLND4pVJeY1M4gWoARC7gsdLNGF/dUi8r1Ftt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Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: DAMON provides damon_aggregated tracepoint, which exposes details of each region and its access monitoring results. It is useful for getting whole monitoring results, e.g., for recording purposes. For investigations of DAMOS, DAMON Sysfs interface provides DAMOS statistics and tried_regions directory. But, those provides only statistics and snapshots. If the scheme is frequently applied and if the user needs to know every detail of DAMOS behavior, the snapshot-based interface could be insufficient and expensive. As a last resort, userspace users need to record the all monitoring results via damon_aggregated tracepoint and simulate how DAMOS would worked. It is unnecessarily complicated. DAMON kernel API users, meanwhile, can do that easily via before_damos_apply() callback field of 'struct damon_callback', though. Add a tracepoint that will be called just after before_damos_apply() callback for more convenient investigations of DAMOS. The tracepoint exposes all details about each regions, similar to damon_aggregated tracepoint. Please note that DAMOS is currently not only for memory management but also for query-like efficient monitoring results retrievals (when 'stat' action is used). Until now, only statistics or snapshots were supported. Addition of this tracepoint allows efficient full recording of DAMOS-based filtered monitoring results. Signed-off-by: SeongJae Park --- include/trace/events/damon.h | 39 ++++++++++++++++++++++++++++++++++++ mm/damon/core.c | 32 ++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h index 0b8d13bde17a..19930bb7af9a 100644 --- a/include/trace/events/damon.h +++ b/include/trace/events/damon.h @@ -9,6 +9,45 @@ #include #include +TRACE_EVENT_CONDITION(damos_before_apply, + + TP_PROTO(unsigned int context_idx, unsigned int scheme_idx, + unsigned int target_idx, struct damon_region *r, + unsigned int nr_regions, bool do_trace), + + TP_ARGS(context_idx, target_idx, scheme_idx, r, nr_regions, do_trace), + + TP_CONDITION(do_trace), + + TP_STRUCT__entry( + __field(unsigned int, context_idx) + __field(unsigned int, scheme_idx) + __field(unsigned long, target_idx) + __field(unsigned long, start) + __field(unsigned long, end) + __field(unsigned int, nr_accesses) + __field(unsigned int, age) + __field(unsigned int, nr_regions) + ), + + TP_fast_assign( + __entry->context_idx = context_idx; + __entry->scheme_idx = scheme_idx; + __entry->target_idx = target_idx; + __entry->start = r->ar.start; + __entry->end = r->ar.end; + __entry->nr_accesses = r->nr_accesses; + __entry->age = r->age; + __entry->nr_regions = nr_regions; + ), + + TP_printk("ctx_idx=%u scheme_idx=%u target_idx=%lu nr_regions=%u %lu-%lu: %u %u", + __entry->context_idx, __entry->scheme_idx, + __entry->target_idx, __entry->nr_regions, + __entry->start, __entry->end, + __entry->nr_accesses, __entry->age) +); + TRACE_EVENT(damon_aggregated, TP_PROTO(unsigned int target_id, struct damon_region *r, diff --git a/mm/damon/core.c b/mm/damon/core.c index ca631dd88b33..3ca34a252a3c 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -950,6 +950,33 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, struct timespec64 begin, end; unsigned long sz_applied = 0; int err = 0; + /* + * We plan to support multiple context per kdamond, as DAMON sysfs + * implies with 'nr_contexts' file. Nevertheless, only single context + * per kdamond is supported for now. So, we can simply use '0' context + * index here. + */ + unsigned int cidx = 0; + struct damos *siter; /* schemes iterator */ + unsigned int sidx = 0; + struct damon_target *titer; /* targets iterator */ + unsigned int tidx = 0; + bool do_trace = false; + + /* get indices for trace_damos_before_apply() */ + if (trace_damos_before_apply_enabled()) { + damon_for_each_scheme(siter, c) { + if (siter == s) + break; + sidx++; + } + damon_for_each_target(titer, c) { + if (titer == t) + break; + tidx++; + } + do_trace = true; + } if (c->ops.apply_scheme) { if (quota->esz && quota->charged_sz + sz > quota->esz) { @@ -964,8 +991,11 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, ktime_get_coarse_ts64(&begin); if (c->callback.before_damos_apply) err = c->callback.before_damos_apply(c, t, r, s); - if (!err) + if (!err) { + trace_damos_before_apply(cidx, sidx, tidx, r, + damon_nr_regions(t), do_trace); sz_applied = c->ops.apply_scheme(c, t, r, s); + } ktime_get_coarse_ts64(&end); quota->total_charged_ns += timespec64_to_ns(&end) - timespec64_to_ns(&begin); From patchwork Tue Sep 12 18:35:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13382029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69F16EE3F0B for ; Tue, 12 Sep 2023 18:36:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD5716B0140; Tue, 12 Sep 2023 14:36:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99C716B0142; Tue, 12 Sep 2023 14:36:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83D5A6B0143; Tue, 12 Sep 2023 14:36:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6A0FE6B0142 for ; Tue, 12 Sep 2023 14:36:07 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3F9D1A020E for ; Tue, 12 Sep 2023 18:36:07 +0000 (UTC) X-FDA: 81228799974.20.A7359A0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 79E0C1A0019 for ; Tue, 12 Sep 2023 18:36:05 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=s5JuUHrp; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694543765; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uOx8ScWSHBi0cBUuCTXtnmBmYJYt+uGhSfTmXKZCMoM=; b=4Jcn4VGCeEHWwDekydw1lU8tmYXC32/ja2zpacCHc/7arZnPLgZgnaAIpguZsH3He0XwPf w2toU4b+Q2O32H5bRzJ9L0sMX01baAqJlck4CaKdxalO7z91b6bBGGEEwc3J728oKGtu1y RYljWB3rSMTitdkFTSp3Yi11HXfngV8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694543765; a=rsa-sha256; cv=none; b=PYLUwOnRmla/oZBn4vfVBG5JqajVTq+Y9M/4RTPGzlx2q5ePdKphwFYNhcRh7PgJVx14ZR +p97XT+Tmfbhdk5C+6X91U5xS7vAIiosWeElPy1BVBTVUlagz4l9n82NIkCWiEUp91NEny 0iAneEdjJdi1rMkc4IZdAakwJIHKX3g= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=s5JuUHrp; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C880616DC; Tue, 12 Sep 2023 18:36:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0063C433CB; Tue, 12 Sep 2023 18:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694543764; bh=yCdyENSSr2jBoqcU5uuhQp9Eg5ZiZzpyIfgAEWQFG08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5JuUHrpz8KMHLkg8aMJ3PtViMENNhZOAtLD6nysZlBWl+uyrhv3zSqqpvNWONwQv QIYEUB0E3w2F8W8SuVnlt4LiU46fzpWpTcGR1gDv0470uUcu68m82Tfb5IOmyGa66v Hgdbt+Em7BmjNyVFjcxWVozqsAVTzx7b/rjX+alJW6jVjsuZIgNTXpXgyaW3GKKxeK PMHGe7U7hSnxaxc51DtQj/mkPe9NSLEC3QTWMD00ClWL2m6C6AGJPKSvg3hCYdOnHn jzuAi2lVeOsQD4elxE82Ev28fTLi035QaPSuhabGm/E8Y0dak2rqeJ+VYu3WK1UTlm /p3a8NJIx8bow== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] Docs/admin-guide/mm/damon/usage: document damos_before_apply tracepoint Date: Tue, 12 Sep 2023 18:35:59 +0000 Message-Id: <20230912183559.4733-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230912183559.4733-1-sj@kernel.org> References: <20230912183559.4733-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 79E0C1A0019 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: ue4npcsdyexyx9zz8u9iohn6y7ptuegn X-HE-Tag: 1694543765-869848 X-HE-Meta: U2FsdGVkX19F850vILlQ07Q8wCUjg2URQ4amFOb8DJA6FYW91+24nLAGveqLTp8E2X7yyJH2f5jskei2XQbZ3btcPyvbCFyyDez3p0txqwli+uJbISBoZN46PLIfwMtR/8QQOXpYLM/w2YMK5osH6VammpqlxieaNsHqOMenbj9K1KM6DQo5RlWlhb9M7/1uPFyUIWtzp/XbiNUAXA/HceFlSPlCIxFf97XqVZwGa9otjX/d+QabclFqNNYP00/sHMaGYj4SNWEX799iacX6Rv3SSXI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alH+CluERx4KnOD3uzuI00M5InYaTlaBApTcx9wrtPVws6pz9RzWo X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Document damos_before_apply tracepoint on the usage document. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 37 ++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 282062b6f134..6272cd36590a 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -496,15 +496,24 @@ the files as above. Above is only for an example. .. _tracepoint: -Tracepoint for Monitoring Results -================================= +Tracepoints for Monitoring Results +================================== Users can get the monitoring results via the :ref:`tried_regions -` or a tracepoint, ``damon:damon_aggregated``. -While the tried regions directory is useful for getting a snapshot, the -tracepoint is useful for getting a full record of the results. While the -monitoring is turned on, you could record the tracepoint events and show -results using tracepoint supporting tools like ``perf``. For example:: +`. The interface is useful for getting a +snapshot, but it could be inefficient for fully recording all the monitoring +results. For the purpose, two trace points, namely ``damon:damon_aggregated`` +and ``damon:damos_before_apply``, are provided. ``damon:damon_aggregated`` +provides the whole monitoring results, while ``damon:damos_before_apply`` +provides the monitoring results for regions that each DAMON-based Operation +Scheme (:ref:`DAMOS `) is gonna be applied. Hence, +``damon:damos_before_apply`` is more useful for recording internal behavior of +DAMOS, or DAMOS target access +:ref:`pattern ` based query-like efficient +monitoring results recording. + +While the monitoring is turned on, you could record the tracepoint events and +show results using tracepoint supporting tools like ``perf``. For example:: # echo on > monitor_on # perf record -e damon:damon_aggregated & @@ -527,6 +536,20 @@ counter). Finally the tenth field (``X``) shows the ``age`` of the region (refer to :ref:`design ` for more details of the counter). +If the event was ``damon:damos_beofre_apply``, the ``perf script`` output would +be somewhat like below:: + + kdamond.0 47293 [000] 80801.060214: damon:damos_before_apply: ctx_idx=0 scheme_idx=0 target_idx=0 nr_regions=11 121932607488-135128711168: 0 136 + [...] + +Each line of the output represents each monitoring region that each DAMON-based +Operation Scheme was about to be applied at the traced time. The first five +fields are as usual. It shows the index of the DAMON context (``ctx_idx=X``) +of the scheme in the list of the contexts of the context's kdamond, the index +of the scheme (``scheme_idx=X``) in the list of the schemes of the context, in +addition to the output of ``damon_aggregated`` tracepoint. + + .. _debugfs_interface: debugfs Interface (DEPRECATED!)