From patchwork Thu Dec 9 13:18:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12666549 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 41A5FC433F5 for ; Thu, 9 Dec 2021 13:18:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 602F86B0073; Thu, 9 Dec 2021 08:18:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B1E76B0074; Thu, 9 Dec 2021 08:18:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47A626B0075; Thu, 9 Dec 2021 08:18:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0180.hostedemail.com [216.40.44.180]) by kanga.kvack.org (Postfix) with ESMTP id 3A7CB6B0073 for ; Thu, 9 Dec 2021 08:18:29 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 06578180BD753 for ; Thu, 9 Dec 2021 13:18:19 +0000 (UTC) X-FDA: 78898309518.15.3B26D07 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf24.hostedemail.com (Postfix) with ESMTP id C7A06180006 for ; Thu, 9 Dec 2021 13:18:17 +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 68C90B82460; Thu, 9 Dec 2021 13:18:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EA3BC341CD; Thu, 9 Dec 2021 13:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639055897; bh=/bpNJdZ+aWFgZMWnCW/UQJnzz/QzCabU/kmiGB685LY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqBxCVD9tK2L6PRlcpj9j0zEiuALm4LQ7ospbxpM4oDC5NKgK+pT7NUtvDfGzBXUv bowLQ+AmJqq6kcLmKORujrQUXgjUlB2rhme7i9QkYFEgTzAJNOFzt9CihaSobak9WQ jcvrSsPSaB6kAOUo0hi0gfb4277d0a11jjVo9PmTWSL90sipI6vlZGV8f7xnX6n2Rj mtkPVUb9gaA53tlPz3xcfQZ2fO+7HD6sXLSVZ1ck7n7Uvl2Y8h/HMEt1HKtpCraAt5 HCU2fCR2UIm5TG58PKhtZv1/GLPYbAh8HinZcApUrLE9jGAxA1ERh76os2lUMhxaqN gCi6JrpcbEaRA== From: SeongJae Park To: akpm@linux-foundation.org Cc: corbet@lwn.net, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 5/6] Docs/admin-guide/mm/damon/usage: Update for kdamond_pid and (mk|rm)_contexts Date: Thu, 9 Dec 2021 13:18:05 +0000 Message-Id: <20211209131806.19317-6-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211209131806.19317-1-sj@kernel.org> References: <20211209131806.19317-1-sj@kernel.org> X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C7A06180006 X-Stat-Signature: xt7rndosuf5ggqfqjh6sgqy5iyegs4rp Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rqBxCVD9; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf24.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org X-HE-Tag: 1639055897-324545 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: The DAMON debugfs usage document is missing descriptions for 'kdamond_pid', 'mk_contexts', and 'rm_contexts' debugfs files. This commit adds those. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 52 ++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 846c85bf4b9d..cb614c84ba9e 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -38,9 +38,9 @@ DAMON provides below three interfaces for different users. debugfs Interface ================= -DAMON exports five files, ``attrs``, ``target_ids``, ``init_regions``, -``schemes`` and ``monitor_on`` under its debugfs directory, -``/damon/``. +DAMON exports eight files, ``attrs``, ``target_ids``, ``init_regions``, +``schemes``, ``monitor_on``, ``kdamond_pid``, ``mk_contexts`` and +``rm_contexts`` under its debugfs directory, ``/damon/``. Attributes @@ -273,6 +273,52 @@ the monitoring is turned on. If you write to the files while DAMON is running, an error code such as ``-EBUSY`` will be returned. +Monitoring Thread PID +--------------------- + +DAMON does requested monitoring with a kernel thread called ``kdamond``. You +can get the pid of the thread by reading the ``kdamond_pid`` file. When the +monitoring is turned off, reading the file returns ``none``. :: + + # cd /damon + # cat monitor_on + off + # cat kdamond_pid + none + # echo on > monitor_on + # cat kdamond_pid + 18594 + + +Using Multiple Monitoring Threads +--------------------------------- + +One ``kdamond`` thread is created for each monitoring context. You can create +and remove monitoring contexts for multiple ``kdamond`` required use case using +the ``mk_contexts`` and ``rm_contexts`` files. + +Writing the name of the new context to the ``mk_contexts`` file creates a +directory of the name on the DAMON debugfs directory. The directory will have +DAMON debugfs files for the context. :: + + # cd /damon + # ls foo + # ls: cannot access 'foo': No such file or directory + # echo foo > mk_contexts + # ls foo + # attrs init_regions kdamond_pid schemes target_ids + +If the context is not needed anymore, you can remove it and the corresponding +directory by putting the name of the context to the ``rm_contexts`` file. :: + + # echo foo > rm_contexts + # ls foo + # ls: cannot access 'foo': No such file or directory + +Note that ``mk_contexts``, ``rm_contexts``, and ``monitor_on`` files are in the +root directory only. + + .. _tracepoint: Tracepoint for Monitoring Results