From patchwork Tue Apr 26 20:38:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12827955 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 C3891C433FE for ; Tue, 26 Apr 2022 20:38:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B79C6B0074; Tue, 26 Apr 2022 16:38:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5666C6B0075; Tue, 26 Apr 2022 16:38:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BAD76B0078; Tue, 26 Apr 2022 16:38:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 287426B0074 for ; Tue, 26 Apr 2022 16:38:54 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 031B61106 for ; Tue, 26 Apr 2022 20:38:53 +0000 (UTC) X-FDA: 79400194188.03.0478B7E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 5488414003E for ; Tue, 26 Apr 2022 20:38:50 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 641E261331; Tue, 26 Apr 2022 20:38:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E726FC385AF; Tue, 26 Apr 2022 20:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651005531; bh=HHKeB02EgCdGBUKl47/DzUNIx/8bb6mqSCa+8N53rZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qk42HV6BFB3rbtCUB0gZoaOgEHm2n/PzxA7mbTRQdb+6IXCrRCSIU8hs23vE3A0Eh 8hLcjBP4FM4RstTEKPg+EX64pqapRr1LRpRt4x5QrWboE46evIra21scwK3jlSAeeV af6ur9taHVDHjUlk4kol/MjKP01cl8GvcwNmhvQdY1agWS5hYKr/bpWkQLtnpxNem2 D81bb7JC8sc+pvEhmX+ocrHA+iBIODe2P/GszZPjc7JMR7mHBfvDJ2LO8INUUGf0gL Uyc3+jl8Fay45kn08CSiuVOenaOszzpi64Ps0x7igL2YY9FAawqc6Nu3qouAm+QV7g vXk1L8doaCtBw== From: sj@kernel.org To: akpm@linux-foundation.org Cc: linux-damon@amazon.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 1/4] mm/damon/core: add a function for damon_operations registration checks Date: Tue, 26 Apr 2022 20:38:40 +0000 Message-Id: <20220426203843.45238-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220426203843.45238-1-sj@kernel.org> References: <20220426203843.45238-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5488414003E X-Stat-Signature: ocp9hpsqkbq4uiyfdadkncnbxf5q9iyb Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Qk42HV6B; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org X-Rspam-User: X-HE-Tag: 1651005530-715023 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: From: SeongJae Park To know if a specific 'damon_operations' is registered, users need to check the kernel config or try 'damon_select_ops()' with the ops of the question, and then see if it successes. In the latter case, the user should also revert the change. To make the process simple and convenient, this commit adds a function for checking if a specific 'damon_operations' is registered or not. Signed-off-by: SeongJae Park --- include/linux/damon.h | 1 + mm/damon/core.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index f23cbfa4248d..73ff0e2d2a4d 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -509,6 +509,7 @@ int damon_set_attrs(struct damon_ctx *ctx, unsigned long sample_int, int damon_set_schemes(struct damon_ctx *ctx, struct damos **schemes, ssize_t nr_schemes); int damon_nr_running_ctxs(void); +bool damon_is_registered_ops(enum damon_ops_id id); int damon_register_ops(struct damon_operations *ops); int damon_select_ops(struct damon_ctx *ctx, enum damon_ops_id id); diff --git a/mm/damon/core.c b/mm/damon/core.c index ca6124eb6516..5c1331f93c2e 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -30,7 +30,7 @@ static DEFINE_MUTEX(damon_ops_lock); static struct damon_operations damon_registered_ops[NR_DAMON_OPS]; /* Should be called under damon_ops_lock with id smaller than NR_DAMON_OPS */ -static bool damon_registered_ops_id(enum damon_ops_id id) +static bool __damon_is_registered_ops(enum damon_ops_id id) { struct damon_operations empty_ops = {}; @@ -39,6 +39,24 @@ static bool damon_registered_ops_id(enum damon_ops_id id) return true; } +/** + * damon_is_registered_ops() - Check if a given damon_operations is registered. + * @id: Id of the damon_operations to check if registered. + * + * Return: true if the ops is set, false otherwise. + */ +bool damon_is_registered_ops(enum damon_ops_id id) +{ + bool registered; + + if (id >= NR_DAMON_OPS) + return false; + mutex_lock(&damon_ops_lock); + registered = __damon_is_registered_ops(id); + mutex_unlock(&damon_ops_lock); + return registered; +} + /** * damon_register_ops() - Register a monitoring operations set to DAMON. * @ops: monitoring operations set to register. @@ -56,7 +74,7 @@ int damon_register_ops(struct damon_operations *ops) return -EINVAL; mutex_lock(&damon_ops_lock); /* Fail for already registered ops */ - if (damon_registered_ops_id(ops->id)) { + if (__damon_is_registered_ops(ops->id)) { err = -EINVAL; goto out; } @@ -84,7 +102,7 @@ int damon_select_ops(struct damon_ctx *ctx, enum damon_ops_id id) return -EINVAL; mutex_lock(&damon_ops_lock); - if (!damon_registered_ops_id(id)) + if (!__damon_is_registered_ops(id)) err = -EINVAL; else ctx->ops = damon_registered_ops[id]; From patchwork Tue Apr 26 20:38:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12827956 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 E559FC433F5 for ; Tue, 26 Apr 2022 20:38:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A92C6B0075; Tue, 26 Apr 2022 16:38:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E1AE6B0078; Tue, 26 Apr 2022 16:38:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A8756B007B; Tue, 26 Apr 2022 16:38:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 1998E6B0075 for ; Tue, 26 Apr 2022 16:38:56 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id E909180C6D for ; Tue, 26 Apr 2022 20:38:55 +0000 (UTC) X-FDA: 79400194230.16.70B3388 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf11.hostedemail.com (Postfix) with ESMTP id C7D814004C for ; Tue, 26 Apr 2022 20:38:52 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 604BCB82324; Tue, 26 Apr 2022 20:38:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 986A8C385A0; Tue, 26 Apr 2022 20:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651005533; bh=ye+LjKF19sj8g3+LRr6BvSaFMe97AXGWcgOi77vqX+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t7XaVBw134K8ApDrlwRjsp7ewuaN3S9FtArmXBU/1Y67xi4cbPkBASSJtAHGdNGii d3e9uJyqYrMnf7JcI6aF1Ya2Q9pdwpcVeR6AiWFxZAdQRyfkmRsG5RGJk774JjSSYZ IoQ/aLF5L5N2Y+MuHEkCBk9feeTPJ2ULfft9kDMWFwuw4TO0SRgyfA3Dk2dEMqukH8 yNEhOleftuRUHFPLXHqpJ9g4eK5Zz9ocZ6LFVhrWBnPGhxaFCx5Bh9vLTrsGStbezK QISOG77qZVvBCDcOo3sApIXh1oe1tJeIM7NAdi4IUjQUXbr/Qi9VBOLLmSFEOvniyN bDo1KF6RVn4yQ== From: sj@kernel.org To: akpm@linux-foundation.org Cc: linux-damon@amazon.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 2/4] mm/damon/sysfs: add a file for listing available monitoring ops Date: Tue, 26 Apr 2022 20:38:41 +0000 Message-Id: <20220426203843.45238-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220426203843.45238-1-sj@kernel.org> References: <20220426203843.45238-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: C7D814004C Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=t7XaVBw1; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspam-User: X-Stat-Signature: e9a1wqycwdjby9dp9mnin4ismh6oy7u6 X-HE-Tag: 1651005532-246714 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: From: SeongJae Park DAMON programming interface users can know if specific monitoring ops set is registered or not using 'damon_is_registered_ops()', but there is no such method for the user space. To help the case, this commit adds a new DAMON sysfs file called 'avail_operations' under each context directory for listing available monitoring ops. Reading the file will list each registered monitoring ops on each line. Signed-off-by: SeongJae Park --- mm/damon/sysfs.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 48e434cd43d8..6ad6364780b8 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1810,6 +1810,21 @@ static void damon_sysfs_context_rm_dirs(struct damon_sysfs_context *context) kobject_put(&context->schemes->kobj); } +static ssize_t avail_operations_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + enum damon_ops_id id; + int len = 0; + + for (id = 0; id < NR_DAMON_OPS; id++) { + if (!damon_is_registered_ops(id)) + continue; + len += sysfs_emit_at(buf, len, "%s\n", + damon_sysfs_ops_strs[id]); + } + return len; +} + static ssize_t operations_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -1840,10 +1855,14 @@ static void damon_sysfs_context_release(struct kobject *kobj) kfree(container_of(kobj, struct damon_sysfs_context, kobj)); } +static struct kobj_attribute damon_sysfs_context_avail_operations_attr = + __ATTR_RO_MODE(avail_operations, 0400); + static struct kobj_attribute damon_sysfs_context_operations_attr = __ATTR_RW_MODE(operations, 0600); static struct attribute *damon_sysfs_context_attrs[] = { + &damon_sysfs_context_avail_operations_attr.attr, &damon_sysfs_context_operations_attr.attr, NULL, }; From patchwork Tue Apr 26 20:38:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12827958 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 9404DC433FE for ; Tue, 26 Apr 2022 20:39:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2FAFA6B007B; Tue, 26 Apr 2022 16:39:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B9CB6B007E; Tue, 26 Apr 2022 16:39:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 122016B0080; Tue, 26 Apr 2022 16:39:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 03ED96B007B for ; Tue, 26 Apr 2022 16:39:00 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CE286274E2 for ; Tue, 26 Apr 2022 20:38:59 +0000 (UTC) X-FDA: 79400194398.30.A3A826B Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf15.hostedemail.com (Postfix) with ESMTP id 8911DA0042 for ; Tue, 26 Apr 2022 20:38:54 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1995B8215C; Tue, 26 Apr 2022 20:38:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61090C385B0; Tue, 26 Apr 2022 20:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651005534; bh=m1JQep2b3SfKr/7CLSAk47zNdHFQtwIgsoJpy0lNAxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uTodtTo6ikP4OlRCyuSvS3rYtbIvHfD5TYO6ziMIaZ2XfUP/Icb71yug7SCjb/P5s XxIvu3pqLwHIEUZrWK9GNGeYmgmqsPegkgyfCJhEfkkU5QhJl2QWnUp+nGRAOosRQR SPoYDrFwEyV73nFHKcWZ/mPOwqrMPJCGUi5zDjGfKnUaMRLaXXj9dASP9VxGS1x5UG gJsaryztCRzWlWQcg+I9kGv/KWCKFVavsRYELr/ECIQj0a00ovvmZTb2UMlbmaHowS Nw3QywFEE8NWZ4xKBd+5Ce+9YjhmvfpUMbTRe/CcwViLCCeF3mPTAALXD+d2rWjrWq Xc7u3KtYAicJQ== From: sj@kernel.org To: akpm@linux-foundation.org Cc: linux-damon@amazon.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 3/4] selftets/damon/sysfs: test existence and permission of avail_operations Date: Tue, 26 Apr 2022 20:38:42 +0000 Message-Id: <20220426203843.45238-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220426203843.45238-1-sj@kernel.org> References: <20220426203843.45238-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 8911DA0042 X-Stat-Signature: et349izttpdwmcqmyst7r98gznh9bxoc Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uTodtTo6; spf=pass (imf15.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-HE-Tag: 1651005534-865031 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: From: SeongJae Park This commit adds a selftest test case for ensuring the existence and the permission (read-only) of the 'avail_oprations' DAMON sysfs file. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh index 2e3ae77cb6db..89592c64462f 100644 --- a/tools/testing/selftests/damon/sysfs.sh +++ b/tools/testing/selftests/damon/sysfs.sh @@ -231,6 +231,7 @@ test_context() { context_dir=$1 ensure_dir "$context_dir" "exist" + ensure_file "$context_dir/avail_operations" "exit" 400 ensure_file "$context_dir/operations" "exist" 600 test_monitoring_attrs "$context_dir/monitoring_attrs" test_targets "$context_dir/targets" From patchwork Tue Apr 26 20:38:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12827957 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 1013EC433F5 for ; Tue, 26 Apr 2022 20:38:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C52F6B0078; Tue, 26 Apr 2022 16:38:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84D6A6B007B; Tue, 26 Apr 2022 16:38:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 716686B007E; Tue, 26 Apr 2022 16:38:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 64C536B0078 for ; Tue, 26 Apr 2022 16:38:58 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 41F752748E for ; Tue, 26 Apr 2022 20:38:58 +0000 (UTC) X-FDA: 79400194356.26.23BACC3 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id E7C5240052 for ; Tue, 26 Apr 2022 20:38:54 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E848A61462; Tue, 26 Apr 2022 20:38:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1F68C385C1; Tue, 26 Apr 2022 20:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651005536; bh=EJTLlpRlUCkEhKFM6MungmBPQeFMLPhClXDK/efWxik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GRwDexlP/87pblyKCM6WAN/LSZPIQ/UBs4lFHVo6lWOaQssnenqG8+L1+WbOTXozY 3SAtRV65+WGruiUFbP62mEBDmt8wqPgSR2kZIIKZ0kfn/Kx05DdtfdMW9Uem3rDTAu wwZtAbLSrzZhQWYR3u1pFlIwKp7wu56aJlmzWRntcdo3D9x72CsjGYlXDbAwfe1HiS lcOm0YeRxKvsJ9a0VsdyXn9aQpDbru6GZ00oZBP3iDtkn6UNqyF2FCy1l5+xj7PKG/ yv5+W0UfjF5halkZSnDOYu1zIQulZCwM9slHj3vT9D64tDiol3YfDrt4j3YVUZgzYM bllirWCyIpNzg== From: sj@kernel.org To: akpm@linux-foundation.org Cc: linux-damon@amazon.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 4/4] Docs/{ABI,admin-guide}/damon: document 'avail_operations' sysfs file Date: Tue, 26 Apr 2022 20:38:43 +0000 Message-Id: <20220426203843.45238-5-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220426203843.45238-1-sj@kernel.org> References: <20220426203843.45238-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: xqhq4ehy57xi9odss5tbpb4woyq6na3f X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E7C5240052 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GRwDexlP; spf=pass (imf11.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 X-Rspam-User: X-HE-Tag: 1651005534-257823 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: From: SeongJae Park This commit updates the DAMON ABI and usage documents for the new sysfs file, 'avail_operations'. Signed-off-by: SeongJae Park --- .../ABI/testing/sysfs-kernel-mm-damon | 10 +++++++++- Documentation/admin-guide/mm/damon/usage.rst | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index 9e282065cbcf..d724b8a12228 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -40,6 +40,12 @@ Description: Writing a number 'N' to this file creates the number of directories for controlling each DAMON context named '0' to 'N-1' under the contexts/ directory. +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//avail_operations +Date: Apr 2022 +Contact: SeongJae Park +Description: Reading this file returns the available monitoring operations + sets on the currently running kernel. + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//operations Date: Mar 2022 Contact: SeongJae Park @@ -47,7 +53,9 @@ Description: Writing a keyword for a monitoring operations set ('vaddr' for virtual address spaces monitoring, and 'paddr' for the physical address space monitoring) to this file makes the context to use the operations set. Reading the file returns the keyword for - the operations set the context is set to use. + the operations set the context is set to use. Note that only + the operations sets that listed in 'avail_operations' file are + valid inputs. What: /sys/kernel/mm/damon/admin/kdamonds//contexts//monitoring_attrs/intervals/sample_us Date: Mar 2022 diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 592ea9a50881..af6ffaea567b 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -68,7 +68,7 @@ comma (","). :: │ kdamonds/nr_kdamonds │ │ 0/state,pid │ │ │ contexts/nr_contexts - │ │ │ │ 0/operations + │ │ │ │ 0/avail_operations,operations │ │ │ │ │ monitoring_attrs/ │ │ │ │ │ │ intervals/sample_us,aggr_us,update_us │ │ │ │ │ │ nr_regions/min,max @@ -143,17 +143,23 @@ be written to the file. contexts// ------------- -In each context directory, one file (``operations``) and three directories -(``monitoring_attrs``, ``targets``, and ``schemes``) exist. +In each context directory, two files (``avail_operations`` and ``operations``) +and three directories (``monitoring_attrs``, ``targets``, and ``schemes``) +exist. DAMON supports multiple types of monitoring operations, including those for -virtual address space and the physical address space. You can set and get what -type of monitoring operations DAMON will use for the context by writing one of -below keywords to, and reading from the file. +virtual address space and the physical address space. You can get the list of +available monitoring operations set on the currently running kernel by reading +``avail_operations`` file. Based on the kernel configuration, the file will +list some or all of below keywords. - vaddr: Monitor virtual address spaces of specific processes - paddr: Monitor the physical address space of the system +You can set and get what type of monitoring operations DAMON will use for the +context by writing one of the keywords listed in ``avail_operations`` file and +reading from the ``operations`` file. + contexts//monitoring_attrs/ ------------------------------