From patchwork Tue Oct 15 17:54:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13836801 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 4E43AD1D893 for ; Tue, 15 Oct 2024 17:54:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D22F26B0088; Tue, 15 Oct 2024 13:54:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB63A6B008C; Tue, 15 Oct 2024 13:54:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAF876B008A; Tue, 15 Oct 2024 13:54:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8CFFD6B0088 for ; Tue, 15 Oct 2024 13:54:26 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EFA31161817 for ; Tue, 15 Oct 2024 17:54:15 +0000 (UTC) X-FDA: 82676586048.14.444CE3F Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf21.hostedemail.com (Postfix) with ESMTP id A53971C0018 for ; Tue, 15 Oct 2024 17:54:09 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="s/NCcirn"; spf=pass (imf21.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729014722; 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=GFyO03v6o400shfSbehsP+T8sr7i2Tn+fOccxPA2+eU=; b=dOxZP+I5VRMojh3/qdzWmkycu0h9NaVKgkaCcwIETO3m/T5FaGml5sKumOtdgE93gidkd8 rDziZvqTgQh+IOffBtTzIUcwW+TqwPFXa6uOoD14YWQVnhzg6jkfDMmYZWG6i2JxznFxXS XytBNAyq9v9QbzyAlzQxXiB0g3bcGVM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729014722; a=rsa-sha256; cv=none; b=BoHH/jPaLsvXM+a0AqTh9F5sP3Xq7JrkLSjXkycmhUojiDK17XGCjtHCZjNLSVJQJTjgiK 2oQN9d74bZn473S7A8zCW9HEYcc99uPOsd6DeRuod2jvxACr+qEiYbC4S/RBBlcGzcg/2a Kj+cFH/JI/Ubqs3ORRHysgow+qLXOdo= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="s/NCcirn"; spf=pass (imf21.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 69499A40CD6; Tue, 15 Oct 2024 17:54:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B779C4CECF; Tue, 15 Oct 2024 17:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729014862; bh=CKcT9mDCKGTEuzVadIyy50mQuu1BV9tFkUqyOuuB6ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s/NCcirnrthjZBo65NC5ZyIo/PFULHy3AJApJ4fo0pvU+IOnNpbXBmPhcapWmn/ez 0fM77vlnUh3lKyh4RuC18EQo+2P9vRNaCsen6+efJLOPb5xivmWyHyztD9yv777Nlq 77NTuZx4JXlpxdfoChorkxo3UH9b8g4qWcBscH4w15elfMP5JxNmmz77Ldr6tVyr/J AwrbvBjKArd9ndQ1KyeYpYJkFkj8asLvwUF73RPLlVdpo9bqj0ab7WhAyIJnaJY3Za cTEbrWV7C9pfTpjnQVLO3m8h9am/O+0RFIMDpylE4Dxl+z5DpUr0mrj+HBd8FdjMrO K3rbCfLb9dBSw== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/7] Docs/admin-guide/mm/damon/usage: remove DAMON debugfs interface documentation Date: Tue, 15 Oct 2024 10:54:06 -0700 Message-Id: <20241015175412.60563-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241015175412.60563-1-sj@kernel.org> References: <20241015175412.60563-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: A53971C0018 X-Stat-Signature: nfqi8h7xo4eza1hc9nm37xrwr4nsnn9k X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1729014849-637008 X-HE-Meta: U2FsdGVkX18n7MlZXVHoWno/g/jtkWJtSf3EYssfwpGboXoXhNAvu+5HRCuWd0/l/CtiPrpEcgbZVXJM0qmaHmiQHQAbYZxdcFfW4NSMu/K0Z9TaLVyrcmWv0ryetIF4ZuCRNSsAzxmgf+jUSLxIER6a2oO+v+ScXDE5v9tx2G1EUM2m/eYU52ajCIbrPNk2n5+e1N9xHVBo/sSushBGYftMiTB760UJc9i/LFzh38ZRqLCuALK810gtkb8SIFm8JYPkJ5ng2dPiHpXEeOWZBmBpE705hBRXbU0LeMnAH289V1z3j8lMDIbVIk/HWlxsb0DMOgYyDV7ZY49a61Roo8uWI8eh6FVMjSQBkFNxVByqpmMN8vgsWEfrJ1OiaDtAOatR/p5UB58BqvcJfZ79TkBiS9y74w7mdscqOTv/JjnVorwPplq9KqBF61EFnzP5qm9E8c8udL0wsWbp8D5PJzywMowYjz/GxlRFL4qJidwiAW6n1c5jdIcWxYE8+RdA/KOZ53O4uxtBC8Xk58sqx/Dtat0Xm5xvVL39dvvsi/r3jExy9S7T/R6Z1M2Gw+zhOWzLIg/o+BP0mYmQJv8Cpz5ZTXJQ/8gnF1CZkpS/QEqPk+WhUyxKYvoQ/bBnnDDt5gCcvkVL3KMoosJi5tfJiTQ36B4ImeRWsLUjZzT9HIexOywXevE1DAEZ8+s3mXUukUgb/5yUxjhHxLdFnWQ8lqj/PjXEGcFNVNgQgDrP+qPzpXVpFkaTa64o8ldUAgRnilGYs/E20qz/trYJ8h4L28Y0QFdRae5mtmk2pwjVZLbZ8eCpmRUVFIl67wD0RK3YL0/NFYFc3LhWq1s6JmF7rJqcJspyenTZ10ulOiR8CJ6zS0i1yoSVPhzd9rvvZWWOh/RtF4QRa/1mIeyT7yhmbOMuuto4DTw1vjShIL/JkdveOXHmmpcNWgp/shdCLbojYqWOI9lMVcFMF9wGOjV 9jaLBh1a U+IEJUTxbDQq0AUW46RSWOXt+60fUqlWHWE0M1zanKNnfQ/N4IQ1wmyb4cyEOEm12nHF46W8X5hrRJpbbBmdTm5lflsOMrsZVebRIZNs9OkPTRaQ75x0WGh+a2R339XYe1IZlbedAlOg2EevguqhTBvnoRhMr6amjMxTsesUSn+675zEx0JlsvxoTSqMuLea6eUfREhj+A7Em62sOkN8RYJ76/VdmPpO45+va7qYp44+vWhK80m2z8VqDsNWOR6rIwk60QQIksfOFgysEf7y/Oy6VzPP2wu0p9TgV 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: List-Subscribe: List-Unsubscribe: It's time to remove DAMON debugfs interface, which has deprecated long before in February 2023. Read the cover letter of this patch series for more details. Remove DAMON debugfs interface usage documentation, to avoid confusing users with documents for an already removed thing. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 309 ------------------- 1 file changed, 309 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index d9be9f7caa7d..c685d87ea078 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -26,12 +26,6 @@ DAMON provides below interfaces for different users. writing kernel space DAMON application programs for you. You can even extend DAMON for various address spaces. For detail, please refer to the interface :doc:`document `. -- *debugfs interface. (DEPRECATED!)* - :ref:`This ` is almost identical to :ref:`sysfs interface - `. This is deprecated, so users should move to the - :ref:`sysfs interface `. If you depend on this and cannot - move, please report your usecase to damon@lists.linux.dev and - linux-mm@kvack.org. .. _sysfs_interface: @@ -600,306 +594,3 @@ 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!) -=============================== - -.. note:: - - THIS IS DEPRECATED! - - DAMON debugfs interface is deprecated, so users should move to the - :ref:`sysfs interface `. If you depend on this and cannot - move, please report your usecase to damon@lists.linux.dev and - linux-mm@kvack.org. - -DAMON exports nine files, ``DEPRECATED``, ``attrs``, ``target_ids``, -``init_regions``, ``schemes``, ``monitor_on_DEPRECATED``, ``kdamond_pid``, -``mk_contexts`` and ``rm_contexts`` under its debugfs directory, -``/damon/``. - - -``DEPRECATED`` is a read-only file for the DAMON debugfs interface deprecation -notice. Reading it returns the deprecation notice, as below:: - - # cat DEPRECATED - DAMON debugfs interface is deprecated, so users should move to DAMON_SYSFS. If you cannot, please report your usecase to damon@lists.linux.dev and linux-mm@kvack.org. - - -Attributes ----------- - -Users can get and set the ``sampling interval``, ``aggregation interval``, -``update interval``, and min/max number of monitoring target regions by -reading from and writing to the ``attrs`` file. To know about the monitoring -attributes in detail, please refer to the :doc:`/mm/damon/design`. For -example, below commands set those values to 5 ms, 100 ms, 1,000 ms, 10 and -1000, and then check it again:: - - # cd /damon - # echo 5000 100000 1000000 10 1000 > attrs - # cat attrs - 5000 100000 1000000 10 1000 - - -Target IDs ----------- - -Some types of address spaces supports multiple monitoring target. For example, -the virtual memory address spaces monitoring can have multiple processes as the -monitoring targets. Users can set the targets by writing relevant id values of -the targets to, and get the ids of the current targets by reading from the -``target_ids`` file. In case of the virtual address spaces monitoring, the -values should be pids of the monitoring target processes. For example, below -commands set processes having pids 42 and 4242 as the monitoring targets and -check it again:: - - # cd /damon - # echo 42 4242 > target_ids - # cat target_ids - 42 4242 - -Users can also monitor the physical memory address space of the system by -writing a special keyword, "``paddr\n``" to the file. Because physical address -space monitoring doesn't support multiple targets, reading the file will show a -fake value, ``42``, as below:: - - # cd /damon - # echo paddr > target_ids - # cat target_ids - 42 - -Note that setting the target ids doesn't start the monitoring. - - -Initial Monitoring Target Regions ---------------------------------- - -In case of the virtual address space monitoring, DAMON automatically sets and -updates the monitoring target regions so that entire memory mappings of target -processes can be covered. However, users can want to limit the monitoring -region to specific address ranges, such as the heap, the stack, or specific -file-mapped area. Or, some users can know the initial access pattern of their -workloads and therefore want to set optimal initial regions for the 'adaptive -regions adjustment'. - -In contrast, DAMON do not automatically sets and updates the monitoring target -regions in case of physical memory monitoring. Therefore, users should set the -monitoring target regions by themselves. - -In such cases, users can explicitly set the initial monitoring target regions -as they want, by writing proper values to the ``init_regions`` file. The input -should be a sequence of three integers separated by white spaces that represent -one region in below form.:: - - - -The ``target idx`` should be the index of the target in ``target_ids`` file, -starting from ``0``, and the regions should be passed in address order. For -example, below commands will set a couple of address ranges, ``1-100`` and -``100-200`` as the initial monitoring target region of pid 42, which is the -first one (index ``0``) in ``target_ids``, and another couple of address -ranges, ``20-40`` and ``50-100`` as that of pid 4242, which is the second one -(index ``1``) in ``target_ids``.:: - - # cd /damon - # cat target_ids - 42 4242 - # echo "0 1 100 \ - 0 100 200 \ - 1 20 40 \ - 1 50 100" > init_regions - -Note that this sets the initial monitoring target regions only. In case of -virtual memory monitoring, DAMON will automatically updates the boundary of the -regions after one ``update interval``. Therefore, users should set the -``update interval`` large enough in this case, if they don't want the -update. - - -Schemes -------- - -Users can get and set the DAMON-based operation :ref:`schemes -` by reading from and writing to ``schemes`` debugfs file. -Reading the file also shows the statistics of each scheme. To the file, each -of the schemes should be represented in each line in below form:: - - - -You can disable schemes by simply writing an empty string to the file. - -Target Access Pattern -~~~~~~~~~~~~~~~~~~~~~ - -The target access :ref:`pattern ` of the -scheme. The ```` is constructed with three ranges in -below form:: - - min-size max-size min-acc max-acc min-age max-age - -Specifically, bytes for the size of regions (``min-size`` and ``max-size``), -number of monitored accesses per aggregate interval for access frequency -(``min-acc`` and ``max-acc``), number of aggregate intervals for the age of -regions (``min-age`` and ``max-age``) are specified. Note that the ranges are -closed interval. - -Action -~~~~~~ - -The ```` is a predefined integer for memory management :ref:`actions -`. The mapping between the ```` values and -the memory management actions is as below. For the detailed meaning of the -action and DAMON operations set supporting each action, please refer to the -list on :ref:`design doc `. - - - 0: ``willneed`` - - 1: ``cold`` - - 2: ``pageout`` - - 3: ``hugepage`` - - 4: ``nohugepage`` - - 5: ``stat`` - -Quota -~~~~~ - -Users can set the :ref:`quotas ` of the given scheme -via the ```` in below form:: - - - -This makes DAMON to try to use only up to ```` milliseconds for applying -the action to memory regions of the ``target access pattern`` within the -```` milliseconds, and to apply the action to only up to -```` bytes of memory regions within the ````. Setting both -```` and ```` zero disables the quota limits. - -For the :ref:`prioritization `, users -can set the weights for the three properties in ```` in below -form:: - - - -Watermarks -~~~~~~~~~~ - -Users can specify :ref:`watermarks ` of the -given scheme via ```` in below form:: - - - -```` is a predefined integer for the metric to be checked. The -supported numbers and their meanings are as below. - - - 0: Ignore the watermarks - - 1: System's free memory rate (per thousand) - -The value of the metric is checked every ```` microseconds. - -If the value is higher than ```` or lower than ````, the -scheme is deactivated. If the value is lower than ````, the scheme -is activated. - -.. _damos_stats: - -Statistics -~~~~~~~~~~ - -It also counts the total number and bytes of regions that each scheme is tried -to be applied, the two numbers for the regions that each scheme is successfully -applied, and the total number of the quota limit exceeds. This statistics can -be used for online analysis or tuning of the schemes. - -The statistics can be shown by reading the ``schemes`` file. Reading the file -will show each scheme you entered in each line, and the five numbers for the -statistics will be added at the end of each line. - -Example -~~~~~~~ - -Below commands applies a scheme saying "If a memory region of size in [4KiB, -8KiB] is showing accesses per aggregate interval in [0, 5] for aggregate -interval in [10, 20], page out the region. For the paging out, use only up to -10ms per second, and also don't page out more than 1GiB per second. Under the -limitation, page out memory regions having longer age first. Also, check the -free memory rate of the system every 5 seconds, start the monitoring and paging -out when the free memory rate becomes lower than 50%, but stop it if the free -memory rate becomes larger than 60%, or lower than 30%".:: - - # cd /damon - # scheme="4096 8192 0 5 10 20 2" # target access pattern and action - # scheme+=" 10 $((1024*1024*1024)) 1000" # quotas - # scheme+=" 0 0 100" # prioritization weights - # scheme+=" 1 5000000 600 500 300" # watermarks - # echo "$scheme" > schemes - - -Turning On/Off --------------- - -Setting the files as described above doesn't incur effect unless you explicitly -start the monitoring. You can start, stop, and check the current status of the -monitoring by writing to and reading from the ``monitor_on_DEPRECATED`` file. -Writing ``on`` to the file starts the monitoring of the targets with the -attributes. Writing ``off`` to the file stops those. DAMON also stops if -every target process is terminated. Below example commands turn on, off, and -check the status of DAMON:: - - # cd /damon - # echo on > monitor_on_DEPRECATED - # echo off > monitor_on_DEPRECATED - # cat monitor_on_DEPRECATED - off - -Please note that you cannot write to the above-mentioned debugfs files while -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_DEPRECATED - off - # cat kdamond_pid - none - # echo on > monitor_on_DEPRECATED - # 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_DEPRECATED`` files -are in the root directory only. From patchwork Tue Oct 15 17:54:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13836802 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 99D27D1D88B for ; Tue, 15 Oct 2024 17:54:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4218D6B0089; Tue, 15 Oct 2024 13:54:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35B4A6B008A; Tue, 15 Oct 2024 13:54:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B0C96B008C; Tue, 15 Oct 2024 13:54:27 -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 CA8EC6B0089 for ; Tue, 15 Oct 2024 13:54:26 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9AFACAC02E for ; Tue, 15 Oct 2024 17:54:08 +0000 (UTC) X-FDA: 82676585754.09.D8E211B Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf04.hostedemail.com (Postfix) with ESMTP id D68894000D for ; Tue, 15 Oct 2024 17:54:14 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=IN553IGY; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729014721; 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=Kskcbc7hF0S38MBLuYBf/K164z9dWeGQGyEFSweVtNw=; b=i9XZzkv+s0pSoZL/NWsLPYWAC5lCOaT3LKzITnpSiqiKD+yXNDBDYlynZM1dZ0uDaJI/cv 37T7LPGioMg0IdrgWp3oL9noUEIO4uhND/+Prbs7WH1jPBCXezRrLqSRbWfjdVIiELD18u Kh67MXdLURjDfeseFFLsbRHWol24Y2E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729014721; a=rsa-sha256; cv=none; b=L16R4Ljbq4rg+D36YylwjzGIEpNoDCDAIapcWoW/eY/wFXJtjPKMmnAOjWXRU/DKvOkLj4 w/rH0oKs/9X6r74oahAA3z+4+ke+wseFQ/t5CebxC98ZKhcnjZz18F4p6o0yUvH9eZmH2R EGIFXScxx8Ycewz7VsMUNJiuJkJgqX4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=IN553IGY; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 21320A43358; Tue, 15 Oct 2024 17:54:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8FACC4CEC6; Tue, 15 Oct 2024 17:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729014863; bh=wNqTcFJIxQW0DGiFjvquOYDznG7ET2BviVO3AFzePVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IN553IGYCEU2daGjInivP6wG0GqSAzY1UIjJtoUptobp/Mi1e1SbYGZ8c4FCruTm/ qtklAPy3K+bvswTj4bT2cK8UcYo4ZqYGYn38LIzSYHJxpWBj5AEOi3Ijba8AE2PLW4 SKVTgx9GC6L2qKGAsYaYEr6akbFYH74Sgna3lEReGrulejAW95EsdPLDpN2cnkguSs zvldwUqzg77Ayt+TqxcrMl8pXczmm0hwtKydMSW6w56qSBhyPljk6mlEDKADUaBu7T OdMJHJAVLYmvWdrccFdnWpQPnk7As+zzqBH7d8KVPruAmReCP1sgUOA41v8MnjR7eF sdZVR9Jm02dRg== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 2/7] Docs/mm/damon/design: update for removal of DAMON debugfs interface Date: Tue, 15 Oct 2024 10:54:07 -0700 Message-Id: <20241015175412.60563-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241015175412.60563-1-sj@kernel.org> References: <20241015175412.60563-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D68894000D X-Stat-Signature: ysj9mwmjtsrpjsq41af1n1byspkmdzba X-HE-Tag: 1729014854-371667 X-HE-Meta: U2FsdGVkX1+qacwpDvKi16PYAFwOlHAShiHQ31cmoM2gZRECVzrpujbfOgTEoGY6sHffrh2lmXu0frvlOSudC1u3TdDy/4ai73QW4ZFpPoAcDiIs0sy63MUPE1725U4V/Ix+/WaUGi9J8JAYQziTHfhrhzF3jGzovYF7sHDIVWbIm8kn3gUPXDnGjMZbaIUrTwG0PuBQRxRQO483Y08La1mlUKnBAky01IbiIxF7TNv4xvScvW7+MJ0EkhSm9sKp111Cr4AAxeUHX1MVgKY8bVLhQFL4PAVurS9Ixt2rZeBVnGqKPchq0/cGHnDozvGhvMUSwbyS6g7+Odqnbe6BS5gNZW/71AVaRn/WVA9ooKsPfy8wCNryIbJ4fQuf++tU0n0GWEY+B5HhyM+f2bNGIH46JXQ8BbMR41so3vqtQ5rswWu+d00h77bTN9PvrvEa5SBj/kq5QQo+XhbnG2qGRGrCBiMy+Isi9t6PS/2cZqja6/QDwSxoIhRTQzrDykb/axhK1vS5MjpZtPsKMV/l6pSL7sBDPhH/bTtHspxN2AcnBHxN494ZwU99x89uWA6NwWhjaGGyfONG4sMCbSyhdRua1jWrkvRqvz2Kl1fTCN9D9zwe9VRkIGJEEJrbNQw16tSTeiGB2FQKpSfLq8e4GgaaEEACelv/ZWNjamricF8gp0nQfocW9v419p3lbxZiTvJ1qlMy7Xi5j6g1s28H+y+Arv3PuTePGwWSCSifKV9QubNgG3ACTWY6Me5d7qipHHY1GLiXPDPDyihYv+oo984UU0xuu+DtCvSGgSuyAcowcxWpql+7aHPRXGO5H2jMetG57Dc4HTnkQzb6hzDT/iHP1cP62zs+q1P/orN49wpL+9nw99holdzwrDUCY0N4QphQTxAl/ZQe0HFtxbrg6dfn9JrPYB/c8onnl/Bff8clggwm7+0Bz/i7WBouCsTLBcOJqfQ1gKq9/bB6X4y FDoFnGVK Bq6Nj1Bdqg1IUpAaVB2Vtcdyp8p0QC20A1PglYaQzRRur6hfhNuLGmSChAjquUbSGveFQWQLAwzWjFJOZn+KgjOIGePWoQ6LJpzTmtm3bN8dZWSOGfKgjs8kV3rU7HaDXoGma80tGy1riYHwbgE0+55epWOpVZXxPIndFSSJBc0MXPqSdCQchZyfKhPVlN8uT93WTZAGq7fpbaViC0c4q4J2PUqrwTvnx/nVSlmJYrDDStc9pV2UG0qHXdDIWFXleDtnT2T1n/gXBU9RJRcbkThzmFOJH3C+hXqTGHCYszxMzM6s9aKituBfw0UkJ8rpXmCEKfGkZj76UVWcaW/MZJ4v+/w== 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: List-Subscribe: List-Unsubscribe: It's time to remove DAMON debugfs interface, which has deprecated long before in February 2023. Read the cover letter of this patch series for more details. Update DAMON design documentation to stop mentioning about the interface, to avoid unnecessary confuses. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index f9c50525bdbf..1c8a43b07b00 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -573,15 +573,11 @@ General Purpose User Interface Modules DAMON modules that provide user space ABIs for general purpose DAMON usage in runtime. -DAMON user interface modules, namely 'DAMON sysfs interface' and 'DAMON debugfs -interface' are DAMON API user kernel modules that provide ABIs to the -user-space. Please note that DAMON debugfs interface is currently deprecated. - -Like many other ABIs, the modules create files on sysfs and debugfs, allow -users to specify their requests to and get the answers from DAMON by writing to -and reading from the files. As a response to such I/O, DAMON user interface -modules control DAMON and retrieve the results as user requested via the DAMON -API, and return the results to the user-space. +Like many other ABIs, the modules create files on pseudo file systems like +'sysfs', allow users to specify their requests to and get the answers from +DAMON by writing to and reading from the files. As a response to such I/O, +DAMON user interface modules control DAMON and retrieve the results as user +requested via the DAMON API, and return the results to the user-space. The ABIs are designed to be used for user space applications development, rather than human beings' fingers. Human users are recommended to use such @@ -590,8 +586,9 @@ Github (https://github.com/damonitor/damo), Pypi (https://pypistats.org/packages/damo), and Fedora (https://packages.fedoraproject.org/pkgs/python-damo/damo/). -Please refer to the ABI :doc:`document ` for -details of the interfaces. +Currently, one module for this type, namely 'DAMON sysfs interface' is +available. Please refer to the ABI :ref:`doc ` for details of +the interfaces. Special-Purpose Access-aware Kernel Modules @@ -599,8 +596,8 @@ Special-Purpose Access-aware Kernel Modules DAMON modules that provide user space ABI for specific purpose DAMON usage. -DAMON sysfs/debugfs user interfaces are for full control of all DAMON features -in runtime. For each special-purpose system-wide data access-aware system +DAMON user interface modules are for full control of all DAMON features in +runtime. For each special-purpose system-wide data access-aware system operations such as proactive reclamation or LRU lists balancing, the interfaces could be simplified by removing unnecessary knobs for the specific purpose, and extended for boot-time and even compile time control. Default values of DAMON From patchwork Tue Oct 15 17:54:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13836803 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 5535ED1D88F for ; Tue, 15 Oct 2024 17:54:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 979986B008A; Tue, 15 Oct 2024 13:54:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88B066B0092; Tue, 15 Oct 2024 13:54:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B9546B0093; Tue, 15 Oct 2024 13:54:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 41A476B008A for ; Tue, 15 Oct 2024 13:54:28 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BD3B61A17AA for ; Tue, 15 Oct 2024 17:54:11 +0000 (UTC) X-FDA: 82676586132.14.D4144F8 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 922474000C for ; Tue, 15 Oct 2024 17:54:22 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZRwj6O7a; spf=pass (imf12.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729014819; 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=hh9tClao64A8WhirNiqIMjwE5KRLcGNeXtjbIBmC8zM=; b=PzI2QhnGbWE0LZPahJ6/tfelXhGwBal1OGxBUFe1TRvxiKKXanHEw+d1OpKlLoRpWvIOBN AD5wg/hSoFifv5uNqXB4UMXbnAyDUq3m9YPmJHRMqBm7f9GtuexqFC4mpytNEx+EjnE6tJ S7DmKHpqsWQp2OvK1rKNs3mVvg9RcC4= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZRwj6O7a; spf=pass (imf12.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729014819; a=rsa-sha256; cv=none; b=5kjfqtJoETKAi5b+yeBWUc8I6lXT2u/pOWyg5y6WrSrM1y7NoyH/pZYZX5JtqsCR5cIFg5 M/hdJ0Yw8sKx395pR1AfDsLgIONmRwHd8TV8PO2KRPsUB+UKjivVY9vVeVyEUhwJwAFiQJ Lh2EPHgUTBdI1oLmH7grBeizua+q6I4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D59305C5DF7; Tue, 15 Oct 2024 17:54:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7A90C4CEC6; Tue, 15 Oct 2024 17:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729014865; bh=7oF79jn9lmm7ZWBErpi45JOkdTnxIklx6KgFpgZJtWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZRwj6O7az1k0rfe6QUN4UubDGCnxPfRgD/fFV9O7VgOyvZFYeHAmHatrF8iS2c48M HM+HZ3n/9fe5ENK+9k3PjOB51b+jiHU20qYQG04hYhGRJpLLxf4dt/C0KEt9i4vRUK i3Ez5U6z09AFYIGB9vOPBbM8mSMIgGvnpWOoIJnsVzJWeG3RvUAFJlwZ9dGplaiXGS 4hyo7A4iwzGUkeq6Pt1SAVXXvWRH4zKaiI9gLAGimKhGYoxVtYcOCTLry+rbQ8sx/d SFBVntz5401F/cpYK0Qm2uvufvwIZpjWtnXsYrBU9/NrLjYEtNmv3rD/ImYBlmhgE0 azYvLs6q6ND8w== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 3/7] selftests/damon/config: remove configs for DAMON debugfs interface selftests Date: Tue, 15 Oct 2024 10:54:08 -0700 Message-Id: <20241015175412.60563-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241015175412.60563-1-sj@kernel.org> References: <20241015175412.60563-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: wm3nd7s6yfqfdo7wnq6zc66opf19nnen X-Rspamd-Queue-Id: 922474000C X-Rspamd-Server: rspam11 X-HE-Tag: 1729014862-343955 X-HE-Meta: U2FsdGVkX18Fkb2fDYYWmEkTagn/YAGeJQBoxMt86zrM60RSnSxSws0xqAS5ztuW42HQGXv7kUfxhsAUe2tS/IHP8U21BYHPreakQbxrru867Xixg6Sz4XsOadU2iEbbuCwf8NNMqAqpblRsiDJQzmigxEFWxBln5BQXhXG0nj+TRwCwzWqPzeYQUf/R3M6dPJ/fD2rzDhNjh9WwNerGyrt0pbaLlDq0n+FJoGGLXH52ABsItP8Twc6k9WhUJMjSyvHoaKAwWiHdvyQ7ccsjjVWHOAAFaIuV+AS+sswkWrrVWA0HO5VcDPHn1gAaxCtDQiPBrA805fe925u758jh2iZle+xCIcwDsZWB6jC5pMan+cAh+aQlOa6NgfIljgGJKk/Fib5QxsNV6upo4zKWLw5dK+LbqyJ3qVlE3EP5w0DrI8h6ZeHTKR7HydyYu02BLSa3cap13ozVAZ5X7tKi0saMJfiOZhW3kiGa5lZDh1YIfFjKf3w28CU/VGxI6dv1zq6emSDc6niMcuuxwbtRdFl5uvStP3IyjveOwEG4HgCLAVttQFLD+IaIhz46P86vV5ZtWhIOxkyBtbW1SS/nKkHt6sJsU3l8b9tr2vUC+tNQpkdNV7iJedAW8WMldwYFWFMcqEqoQWpJdOpfqMUXvHNd47HGQyO5cO24lk7L7ijD0uDo5/r680GxP+HXOH+9Awy1oNTINH6nOF9jx9px9+0d3Zmw7RtC0Pyi4JrRvW8kYusLr6tgpDSGJwSI/jAhxP+7QX+a8SaycGbZzaGudfGlMbeKS0S2E5rXorJzduVrTunW9SGQr8mzVwXBVJIf7gBMF37Gmo8LvW5JS7tf9REg8eU6eCuoA6VlEhYkqIw3cSBkY3PxV1SU7N2d1UlJqMLIpt5cQ2oqujfGqawI5y1K89taX1HvVJynPA5Ot6cfykXtiyzbBmLvjuFaHa93QG2IYpB23DAZzVwkq16 qWrNJq7Z soWM6+1JDGHiSCzAdiqWDAeMboMz+TR1U3Af6WOEuyv4SvSg+gKFccWF/bO5bo/NckJfiWCeCi/wZrxWlVhimZHP3ZwHq7K799PjQD5JM2q9aKvWA4djlydlXO01XpZYamOphqFo6v1slkjwwQL6afSgERz2W/ROhHHu1UhGUgyneGbr6A72ZhkX8Cih+tncbcZYFbovl7qHGAoydyQ/4J+NzdpSJmUFTnEZZdv+sbxKig6Q= 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: List-Subscribe: List-Unsubscribe: It's time to remove DAMON debugfs interface, which has deprecated long before in February 2023. Read the cover letter of this patch series for more details. Remove configs for selftests of it from DAMON selftests config file, to prevent unnecessary noises from the tests. [1] https://lore.kernel.org/20230209192009.7885-1-sj@kernel.org Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/config | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/damon/config b/tools/testing/selftests/damon/config index 0daf38974eb0..a68a9fead5dc 100644 --- a/tools/testing/selftests/damon/config +++ b/tools/testing/selftests/damon/config @@ -1,6 +1,5 @@ CONFIG_DAMON=y CONFIG_DAMON_SYSFS=y -CONFIG_DAMON_DBGFS=y CONFIG_DAMON_PADDR=y CONFIG_DAMON_VADDR=y CONFIG_DAMON_RECLAIM=y From patchwork Tue Oct 15 17:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13836804 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 E6AC9D1D88B for ; Tue, 15 Oct 2024 17:54:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 384486B0092; Tue, 15 Oct 2024 13:54:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E7046B0093; Tue, 15 Oct 2024 13:54:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 001726B0095; Tue, 15 Oct 2024 13:54:29 -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 CBA8D6B0092 for ; Tue, 15 Oct 2024 13:54:29 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 65B161217DC for ; Tue, 15 Oct 2024 17:54:21 +0000 (UTC) X-FDA: 82676585838.20.EB444FC Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf01.hostedemail.com (Postfix) with ESMTP id 6A23340014 for ; Tue, 15 Oct 2024 17:54:21 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bHlwaDVq; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729014820; a=rsa-sha256; cv=none; b=YmlGcGD/Z8FddPdWOf8jbDUDzyqPojKDwwxyTvSBJ+NbLhNDFIJmqqxPSAFZHPs36hz5nG xeFsrxH1gs0vnxnWC9GkOisMUMUKV2FkmgvrvNSsrP7af2iawnMx5/MjjpR/xPnwcCYvzi q/cF6TivjrDJ3VzC8Xn5IrFa2YdNK6k= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bHlwaDVq; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 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=1729014820; 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=XEMOTjK5z5mKN2L/N/oR5jiZIdzsV5E6LSqXBjPdtEQ=; b=Y6w1NLFkJ/Zfvx2yhfXiYYG7is85lnE0utZGuxoUXEhHxrb8eC2C0yTonoLEjVxH+wyC1e mYl6I98oSg+9C/yUhIljzBVby0xEcflAWDi3nHgw9TkVudCF4xGT9l8A+mKTE9UHO6ZHGj 7HFTCNFPKra2RIv7BU/S6EQbMjFRCCA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id A4AEAA43358; Tue, 15 Oct 2024 17:54:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3B78C4CEC7; Tue, 15 Oct 2024 17:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729014866; bh=0Hh2QMFBW1aSAnc+4PuGanKNHQGEFuqZ1dsyyv6x/qA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHlwaDVqMsH0XSWdMbi7ukCdTnwnWTUbtysf0GmDb8+tO7xXP4p7wnGNR93BTUUGu Xqf/Mh/u5wXUQimx9akVJ1j5V/7ratrbknhc9Ge+zeI23jF6onlF9yAD74eQ8bHfD3 2xSpUppkTbrKkIGJeL1reybI1VZklRaXomolyfedL2Flj0ojBAdBmuLOkjHNshTQXg F4UO1WNw7AXplOE/zy+6qe0SpvntzGeVgv0j67yZAgk665LTq9K2/D2pRHyCnNZrs+ 0xXKJYS3G4CR0UTD5rdGjjx+fWEPKIiVzQqUxXR1vsF8Chc8VYfbomE263vmwKj7HF Rfg3Vul8dw6DQ== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 4/7] selftests/damon: remove tests for DAMON debugfs interface Date: Tue, 15 Oct 2024 10:54:09 -0700 Message-Id: <20241015175412.60563-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241015175412.60563-1-sj@kernel.org> References: <20241015175412.60563-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 6A23340014 X-Rspamd-Server: rspam01 X-Stat-Signature: c39z6zg4afidx9n94ucb1xmwtn7ruoe8 X-HE-Tag: 1729014861-128138 X-HE-Meta: U2FsdGVkX1+L6P3BMWmHUIKTpsJgcg4T5LaUd54RYkSE9bDeAQZC3KlO/IF0QsiemqGdKNAKK5mh62DTe8+F9VQkwGgkISwaWyGurmPfXAspvEOfIBmLUgSGOWQMG8z4qiRLBu7WTNxtXwW4mBkHvSB9k8974c6nkTq2xN2bs1MoWQ5SqTtUMclCFVOETKWaIfh07YmA8e1jKIaOcZ55U5j5vGENkUdDx9Ka2WDl35UvR+sLeYBjInHD1FYiezbEBErcVOEq7hRlRH3GtwSIaHF4H8ppMpmVr9Z6e3/A9fpeIjyvBSxp9hJ2AtEVs/N64OQ+5XNF0ftiG8gWSYsvQV4T/+8GRooeJeiB1UBry4VwQmajMa5XZ4X6KHMokCPEidwnXS+2UnERVxel3i+SjEradEO2Ecrh6guquWRgAgK0RR8YE+YshInggpYWHxXh2l72fFJBz7HsbG9l3msWlj3oOpM7bGKLg1Ok3bgA51RGb6aK6QNTpV0vdRFLpdi+jSYBZQGKJfQuFtaEbklBmPb2pxZv2fJAn4VqYYwjuTC48ylAFcpAapT9xqcVcfiQwsUrz2xMU3sqhTAfGM6JX0ZqZt5nOSKNJ1MX9dWGygp2s8gh1Lbwj3aRK8OUrakWyhX6hM81lr4iKAdwQ2dubOSiNRBVFahTWSFn962Jp2qi3btIT9f6Cplzg5cC3Uz4ujxODpgXxb6e7e23DZxPkb6Ed2CL8L0bQn1LV0KLsE+Cgqd8j1h+ztHJc4Uf+4JfbBu8xdQWgdmW3M4lXwJi7Hr0hNkdYZLyp/t32mu2UPtk8kP0pFduwb8SwMfCv3T+GEfCX/Npi7JqRABNVQg2Oby2anmOauU4igMBCtzoa6XVWRk0JmeMOFlk62l/WZTp0Pheoh22Dfq4FSoaaFUKkUbFm8CZ9RY3w9j+SfaqD1XEmIb1cGZDMRWpHp3bXEyeC3nSRZ1m1z5M/AM7Gft fEHmqqeH Qm1sk/woY6knpMPEcaJrfQx5naWDhfpNE9lXCowFqLcifxqIDmBMLib4KwXtCk3U7udysRmDWu/2I5d5hElp6ZFtwSeEXxyy8XH66Av5O9hU+QWq2pQUaMhLCHE9HYLvs7zYWcv2S5cS5meCpdMSMf0oYYlT4/pRDlmiSlEvXD7ic85kXYPILzSF9LEozbjUHlQhIqYn4JtTa8eyN2LkO558kYphyoJvzbDMDFtF/gQxQCpo= 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: List-Subscribe: List-Unsubscribe: It's time to remove DAMON debugfs interface, which has deprecated long before in February 2023. Read the cover letter of this patch series for more details. Remove selftests for the interface, to prevent causing unnecessary test failures. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/.gitignore | 3 - tools/testing/selftests/damon/Makefile | 11 +-- .../testing/selftests/damon/debugfs_attrs.sh | 17 ---- .../debugfs_duplicate_context_creation.sh | 27 ------- .../selftests/damon/debugfs_empty_targets.sh | 21 ----- .../damon/debugfs_huge_count_read_write.sh | 22 ----- .../damon/debugfs_rm_non_contexts.sh | 19 ----- .../selftests/damon/debugfs_schemes.sh | 19 ----- .../selftests/damon/debugfs_target_ids.sh | 19 ----- .../damon/debugfs_target_ids_pid_leak.c | 68 ---------------- .../damon/debugfs_target_ids_pid_leak.sh | 22 ----- ...fs_target_ids_read_before_terminate_race.c | 80 ------------------- ...s_target_ids_read_before_terminate_race.sh | 14 ---- .../selftests/damon/huge_count_read_write.c | 48 ----------- 14 files changed, 1 insertion(+), 389 deletions(-) delete mode 100755 tools/testing/selftests/damon/debugfs_attrs.sh delete mode 100755 tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh delete mode 100755 tools/testing/selftests/damon/debugfs_empty_targets.sh delete mode 100755 tools/testing/selftests/damon/debugfs_huge_count_read_write.sh delete mode 100755 tools/testing/selftests/damon/debugfs_rm_non_contexts.sh delete mode 100755 tools/testing/selftests/damon/debugfs_schemes.sh delete mode 100755 tools/testing/selftests/damon/debugfs_target_ids.sh delete mode 100644 tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c delete mode 100755 tools/testing/selftests/damon/debugfs_target_ids_pid_leak.sh delete mode 100644 tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.c delete mode 100755 tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.sh delete mode 100644 tools/testing/selftests/damon/huge_count_read_write.c diff --git a/tools/testing/selftests/damon/.gitignore b/tools/testing/selftests/damon/.gitignore index 2ab675fecb6b..2f0297657c81 100644 --- a/tools/testing/selftests/damon/.gitignore +++ b/tools/testing/selftests/damon/.gitignore @@ -1,6 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -huge_count_read_write -debugfs_target_ids_read_before_terminate_race -debugfs_target_ids_pid_leak access_memory access_memory_even diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile index 5b2a6a5dd1af..fa6042998004 100644 --- a/tools/testing/selftests/damon/Makefile +++ b/tools/testing/selftests/damon/Makefile @@ -1,15 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for damon selftests -TEST_GEN_FILES += huge_count_read_write -TEST_GEN_FILES += debugfs_target_ids_read_before_terminate_race -TEST_GEN_FILES += debugfs_target_ids_pid_leak TEST_GEN_FILES += access_memory access_memory_even -TEST_FILES = _chk_dependency.sh _debugfs_common.sh +TEST_FILES = _chk_dependency.sh # functionality tests -TEST_PROGS = debugfs_attrs.sh debugfs_schemes.sh debugfs_target_ids.sh TEST_PROGS += sysfs.sh TEST_PROGS += sysfs_update_schemes_tried_regions_wss_estimation.py TEST_PROGS += damos_quota.py damos_quota_goal.py damos_apply_interval.py @@ -17,11 +13,6 @@ TEST_PROGS += damos_tried_regions.py damon_nr_regions.py TEST_PROGS += reclaim.sh lru_sort.sh # regression tests (reproducers of previously found bugs) -TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh -TEST_PROGS += debugfs_duplicate_context_creation.sh -TEST_PROGS += debugfs_rm_non_contexts.sh -TEST_PROGS += debugfs_target_ids_read_before_terminate_race.sh -TEST_PROGS += debugfs_target_ids_pid_leak.sh TEST_PROGS += sysfs_update_removed_scheme_dir.sh TEST_PROGS += sysfs_update_schemes_tried_regions_hang.py diff --git a/tools/testing/selftests/damon/debugfs_attrs.sh b/tools/testing/selftests/damon/debugfs_attrs.sh deleted file mode 100755 index 902e312bca89..000000000000 --- a/tools/testing/selftests/damon/debugfs_attrs.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -source _debugfs_common.sh - -# Test attrs file -# =============== - -file="$DBGFS/attrs" -orig_content=$(cat "$file") - -test_write_succ "$file" "1 2 3 4 5" "$orig_content" "valid input" -test_write_fail "$file" "1 2 3 4" "$orig_content" "no enough fields" -test_write_fail "$file" "1 2 3 5 4" "$orig_content" \ - "min_nr_regions > max_nr_regions" -test_content "$file" "$orig_content" "1 2 3 4 5" "successfully written" -echo "$orig_content" > "$file" diff --git a/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh b/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh deleted file mode 100755 index 4a76e37ef16b..000000000000 --- a/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -source _debugfs_common.sh - -# Test duplicated context creation -# ================================ - -if ! echo foo > "$DBGFS/mk_contexts" -then - echo "context creation failed" - exit 1 -fi - -if echo foo > "$DBGFS/mk_contexts" -then - echo "duplicate context creation success" - exit 1 -fi - -if ! echo foo > "$DBGFS/rm_contexts" -then - echo "context deletion failed" - exit 1 -fi - -exit 0 diff --git a/tools/testing/selftests/damon/debugfs_empty_targets.sh b/tools/testing/selftests/damon/debugfs_empty_targets.sh deleted file mode 100755 index effbea33dc16..000000000000 --- a/tools/testing/selftests/damon/debugfs_empty_targets.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -source _debugfs_common.sh - -# Test empty targets case -# ======================= - -orig_target_ids=$(cat "$DBGFS/target_ids") -echo "" > "$DBGFS/target_ids" - -if [ -f "$DBGFS/monitor_on_DEPRECATED" ] -then - monitor_on_file="$DBGFS/monitor_on_DEPRECATED" -else - monitor_on_file="$DBGFS/monitor_on" -fi - -orig_monitor_on=$(cat "$monitor_on_file") -test_write_fail "$monitor_on_file" "on" "orig_monitor_on" "empty target ids" -echo "$orig_target_ids" > "$DBGFS/target_ids" diff --git a/tools/testing/selftests/damon/debugfs_huge_count_read_write.sh b/tools/testing/selftests/damon/debugfs_huge_count_read_write.sh deleted file mode 100755 index 922cadac2950..000000000000 --- a/tools/testing/selftests/damon/debugfs_huge_count_read_write.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -source _debugfs_common.sh - -# Test huge count read write -# ========================== - -dmesg -C - -for file in "$DBGFS/"* -do - ./huge_count_read_write "$file" -done - -if dmesg | grep -q WARNING -then - dmesg - exit 1 -else - exit 0 -fi diff --git a/tools/testing/selftests/damon/debugfs_rm_non_contexts.sh b/tools/testing/selftests/damon/debugfs_rm_non_contexts.sh deleted file mode 100755 index f3ffeb1343cf..000000000000 --- a/tools/testing/selftests/damon/debugfs_rm_non_contexts.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -source _debugfs_common.sh - -# Test putting non-ctx files/dirs to rm_contexts file -# =================================================== - -dmesg -C - -for file in "$DBGFS/"* -do - (echo "$(basename "$f")" > "$DBGFS/rm_contexts") &> /dev/null - if dmesg | grep -q BUG - then - dmesg - exit 1 - fi -done diff --git a/tools/testing/selftests/damon/debugfs_schemes.sh b/tools/testing/selftests/damon/debugfs_schemes.sh deleted file mode 100755 index 5b39ab44731c..000000000000 --- a/tools/testing/selftests/damon/debugfs_schemes.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -source _debugfs_common.sh - -# Test schemes file -# ================= - -file="$DBGFS/schemes" -orig_content=$(cat "$file") - -test_write_succ "$file" "1 2 3 4 5 6 4 0 0 0 1 2 3 1 100 3 2 1" \ - "$orig_content" "valid input" -test_write_fail "$file" "1 2 -3 4 5 6 3 0 0 0 1 2 3 1 100 3 2 1" "$orig_content" "multi lines" -test_write_succ "$file" "" "$orig_content" "disabling" -test_write_fail "$file" "2 1 2 1 10 1 3 10 1 1 1 1 1 1 1 1 2 3" \ - "$orig_content" "wrong condition ranges" -echo "$orig_content" > "$file" diff --git a/tools/testing/selftests/damon/debugfs_target_ids.sh b/tools/testing/selftests/damon/debugfs_target_ids.sh deleted file mode 100755 index 49aeabdb0aae..000000000000 --- a/tools/testing/selftests/damon/debugfs_target_ids.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -source _debugfs_common.sh - -# Test target_ids file -# ==================== - -file="$DBGFS/target_ids" -orig_content=$(cat "$file") - -test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input" -test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input" -test_content "$file" "$orig_content" "1 2" "non-integer was there" -test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input" -test_content "$file" "$orig_content" "" "wrong input written" -test_write_succ "$file" "" "$orig_content" "empty input" -test_content "$file" "$orig_content" "" "empty input written" -echo "$orig_content" > "$file" diff --git a/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c b/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c deleted file mode 100644 index 0cc2eef7d142..000000000000 --- a/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Author: SeongJae Park - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DBGFS_TARGET_IDS "/sys/kernel/debug/damon/target_ids" - -static void write_targetid_exit(void) -{ - int target_ids_fd = open(DBGFS_TARGET_IDS, O_RDWR); - char pid_str[128]; - - snprintf(pid_str, sizeof(pid_str), "%d", getpid()); - write(target_ids_fd, pid_str, sizeof(pid_str)); - close(target_ids_fd); - exit(0); -} - -unsigned long msec_timestamp(void) -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - return tv.tv_sec * 1000UL + tv.tv_usec / 1000; -} - -int main(int argc, char *argv[]) -{ - unsigned long start_ms; - int time_to_run, nr_forks = 0; - - if (argc != 2) { - fprintf(stderr, "Usage: %s \n", argv[0]); - exit(1); - } - time_to_run = atoi(argv[1]); - - start_ms = msec_timestamp(); - while (true) { - int pid = fork(); - - if (pid < 0) { - fprintf(stderr, "fork() failed\n"); - exit(1); - } - if (pid == 0) - write_targetid_exit(); - wait(NULL); - nr_forks++; - - if (msec_timestamp() - start_ms > time_to_run) - break; - } - printf("%d\n", nr_forks); - return 0; -} diff --git a/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.sh b/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.sh deleted file mode 100755 index 31fe33c2b032..000000000000 --- a/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -before=$(grep "^pid " /proc/slabinfo | awk '{print $2}') - -nr_leaks=$(./debugfs_target_ids_pid_leak 1000) -expected_after_max=$((before + nr_leaks / 2)) - -after=$(grep "^pid " /proc/slabinfo | awk '{print $2}') - -echo > /sys/kernel/debug/damon/target_ids - -echo "tried $nr_leaks pid leak" -echo "number of active pid slabs: $before -> $after" -echo "(up to $expected_after_max expected)" -if [ $after -gt $expected_after_max ] -then - echo "maybe pids are leaking" - exit 1 -else - exit 0 -fi diff --git a/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.c b/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.c deleted file mode 100644 index b06f52a8ce2d..000000000000 --- a/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.c +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Author: SeongJae Park - */ -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DBGFS_MONITOR_ON "/sys/kernel/debug/damon/monitor_on_DEPRECATED" -#define DBGFS_TARGET_IDS "/sys/kernel/debug/damon/target_ids" - -static void turn_damon_on_exit(void) -{ - int target_ids_fd = open(DBGFS_TARGET_IDS, O_RDWR); - int monitor_on_fd = open(DBGFS_MONITOR_ON, O_RDWR); - char pid_str[128]; - - snprintf(pid_str, sizeof(pid_str), "%d", getpid()); - write(target_ids_fd, pid_str, sizeof(pid_str)); - write(monitor_on_fd, "on\n", 3); - close(target_ids_fd); - close(monitor_on_fd); - usleep(1000); - exit(0); -} - -static void try_race(void) -{ - int target_ids_fd = open(DBGFS_TARGET_IDS, O_RDWR); - int pid = fork(); - int buf[256]; - - if (pid < 0) { - fprintf(stderr, "fork() failed\n"); - exit(1); - } - if (pid == 0) - turn_damon_on_exit(); - while (true) { - int status; - - read(target_ids_fd, buf, sizeof(buf)); - if (waitpid(-1, &status, WNOHANG) == pid) - break; - } - close(target_ids_fd); -} - -static inline uint64_t ts_to_ms(struct timespec *ts) -{ - return (uint64_t)ts->tv_sec * 1000 + (uint64_t)ts->tv_nsec / 1000000; -} - -int main(int argc, char *argv[]) -{ - struct timespec start_time, now; - int runtime_ms; - - if (argc != 2) { - fprintf(stderr, "Usage: %s \n", argv[0]); - exit(1); - } - runtime_ms = atoi(argv[1]); - clock_gettime(CLOCK_MONOTONIC, &start_time); - while (true) { - try_race(); - clock_gettime(CLOCK_MONOTONIC, &now); - if (ts_to_ms(&now) - ts_to_ms(&start_time) > runtime_ms) - break; - } - return 0; -} diff --git a/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.sh b/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.sh deleted file mode 100755 index fc793c4c9aea..000000000000 --- a/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -dmesg -C - -./debugfs_target_ids_read_before_terminate_race 5000 - -if dmesg | grep -q dbgfs_target_ids_read -then - dmesg - exit 1 -else - exit 0 -fi diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c deleted file mode 100644 index a6fe0689f88d..000000000000 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Author: SeongJae Park - */ - -#include -#include -#include -#include - -#pragma GCC diagnostic push -#if __GNUC__ >= 11 && __GNUC_MINOR__ >= 1 -/* Ignore read(2) overflow and write(2) overread compile warnings */ -#pragma GCC diagnostic ignored "-Wstringop-overread" -#pragma GCC diagnostic ignored "-Wstringop-overflow" -#endif - -void write_read_with_huge_count(char *file) -{ - int filedesc = open(file, O_RDWR); - char buf[25]; - int ret; - - printf("%s %s\n", __func__, file); - if (filedesc < 0) { - fprintf(stderr, "failed opening %s\n", file); - exit(1); - } - - write(filedesc, "", 0xfffffffful); - perror("after write: "); - ret = read(filedesc, buf, 0xfffffffful); - perror("after read: "); - close(filedesc); -} - -#pragma GCC diagnostic pop - -int main(int argc, char *argv[]) -{ - if (argc != 2) { - fprintf(stderr, "Usage: %s \n", argv[0]); - exit(1); - } - write_read_with_huge_count(argv[1]); - - return 0; -} From patchwork Tue Oct 15 17:54:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13836805 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 238D6D1D895 for ; Tue, 15 Oct 2024 17:54:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A155C6B0093; Tue, 15 Oct 2024 13:54:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99F796B0098; Tue, 15 Oct 2024 13:54:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C7EB6B0096; Tue, 15 Oct 2024 13:54:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 58B726B0095 for ; Tue, 15 Oct 2024 13:54:30 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F1C0A1C5922 for ; Tue, 15 Oct 2024 17:54:19 +0000 (UTC) X-FDA: 82676585964.13.011BA0B Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf26.hostedemail.com (Postfix) with ESMTP id C7AF6140004 for ; Tue, 15 Oct 2024 17:54:22 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jgEoebN5; spf=pass (imf26.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729014724; 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=bOYIpV3Mdigs/c7IaK3x48C9uoyX4Yd/uVkAZUwuqjU=; b=VvqCrisHkgy61B+ZNr3CIQONHDS4PBqOS03G2JsFl7wOXRxT/CdrbOL/v0LNGaizEHY+78 968gkeHqd/+dnRH6FfZuCCIuSbCBfPwt3U3y9Ax4rukT78kNvzEE+d7Z1XA9XJ3FbKt2Ei dGh0at+2Dv8wieCmGjqV6pFOdoNe0ZE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729014724; a=rsa-sha256; cv=none; b=X1vkv2kGWTrSlmU6AC4Q/m715LuWSt0zWjlCjVq33gQ3ODB02zme8qjZsypHwGIjG1GdVm nVl9uuu+H1tL61BWZcCwQNQpgDkrZvsn86emhd2Vvy2PM7jT8LEoqdngCkcFbEYQSPKGOj HQseJ0L80TQC0mtaEwMUd4IVG89+9cI= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jgEoebN5; spf=pass (imf26.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id A6D2EA433F3; Tue, 15 Oct 2024 17:54:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25B67C4CEDA; Tue, 15 Oct 2024 17:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729014867; bh=oYXb5ELfdFSBlBTaf0WAv5hcBOQ7eaf8Vl277fIm8X4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgEoebN5ggv7bJIo+tsNgprDtKq52wrOPozQdSYwCVYN+SgZfqUvnrAPLS8D/ibpJ 4tRo5REmWLrJjKyeBovXYKZA5W9qTNPB9fltaGLfZV72T48xutIrBPinTlwTVcTBwf 55J4Li7dQGrXMBg08rbbkW6nYCOggKydEWolHwTj1SDocyvqL+RDJozEtZo8EP562L 8tbIhbmmyQJ0NlLTdXu+URKTqB+H+IsV+Apl84HDOwKXJVFZTFuFkHA4CvE3qv6WOv C1y3HDKtF2X3pvYNbtG5f3Qb0IH1f9yPMPu9t2xKZK659xiYZFUGZeR/yk125lTTvH 9O8PwBMbOubuA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Brendan Higgins , David Gow , Rae Moar , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org Subject: [RFC PATCH 5/7] kunit: configs: remove configs for DAMON debugfs interface tests Date: Tue, 15 Oct 2024 10:54:10 -0700 Message-Id: <20241015175412.60563-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241015175412.60563-1-sj@kernel.org> References: <20241015175412.60563-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: hhk5mopbr47j5d3ondcwrtzz4sdjk4c7 X-Rspamd-Queue-Id: C7AF6140004 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1729014862-698859 X-HE-Meta: U2FsdGVkX1+HKV0MflhaVYqae+LKIBvLZoheADIyNhSJFbFo9INTAY8muoTXDAP/xeuSok5IwvezwCec6HUi3BScqB1KLwM6v/mRvmaCudGOAfzXE8iBz8uDPMjiJOWjQS0pvE6rxHpgsfTbl8KMMYe8WFAcgsAQwnKuJh/HbN85upKCgNbVOWBEd/vRkOq42QWsq0j9wuDVRmV9wcIlW4UukPNBPp6pEAsDoFZex/lNwyOnG+yJvT7tibgKGp3KEGomL8as2hJwp9n+NBNCKx+C/zFO4y0T6LoN67kXnMVS3Ljx3DlmdlL5L8qz/CFo0/VB73Kn1qaz+DaNcnerRqeXRy493zv+VwE+FSNpEZQqWp3/QdPZEeZuQQ+yUA6jAbhZfF0/z/Ja7Ke+Rt4fiF4xEOT3ob6W+Bae1iHVYWscUULmgIlX4cxcazuUGaWhTriP8YxvJnfmhfctKc/PdOr/gcLYgn2xcE7DKQns2PT6xG26ZbHyal07462VCYnotD0DQ+wn80vu705Ho1G36cNrQycFWhIAAsi+K64/7v3Tl4wkZXQQ0M2cHUOh7txHP0PSV9yjh4NGl+uwcmA33IGv6eYWKMRPN2cCGi8ZCkugmZ4+JZCok00r0XZGYutmvaQ0Fadn5u4Lml2hUoSLDevW5Fk9TjQcwC1ZsfjMujbTIJxOv1rRZGmUv+7irB3M2f3esFfgEyPKk/tCvApXkduQUGm6bOTKeKF2E3Hv5OuqHJ3r4mV6GTLFU3YqxXBENFHxTyjr9fzwq4DQJBRZ7YXGWzbk0qa/mlYz1DWUW24StHaPY6/YrGXglHTq16RLgrycMXzZ5G2nQO51qaZOvlqO7nAo83Fkn+1UY2i9oHbDEJLTLTip73hiH372o9eSdRVzK5Mf3YT78xqmFKCuFjc8+IAe8tDHaZp8tlT3Od1XjzdZQcFfeai5zp+GicY5pvo/K2fCovtoh/MgatZ yo2Rae+c MsO0HXQ9+PjgRiFdaYqkFjq0WgdipzemNhz9kRM0BkrYqWoCQIID0CMM6vw5xrYStsjcRakqOi06/sg/Tx67dQXjuLNZcmhSTX/GhvMU5328WC+7wlZZUzSkgFgjdnWJOXgslg08B7pjYFdg5rvgF/wxNv18ckKf7PHavyjVV8Q7ybrez8Q8+DFKUrutpntxree+0hdy7MB8G6ZD+U5NCmXYAa9vzKir4LQCii6sSJ+xARy8= 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: List-Subscribe: List-Unsubscribe: It's time to remove DAMON debugfs interface, which has deprecated long before in February 2023. Read the cover letter of this patch series for more details. Remove kernel configs for running DAMON debugfs interface kunit tests from the kunit all_tests configuration, to prevent unnecessary noises from tests. Signed-off-by: SeongJae Park --- tools/testing/kunit/configs/all_tests.config | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/testing/kunit/configs/all_tests.config b/tools/testing/kunit/configs/all_tests.config index b3b00269a52a..b0049be00c70 100644 --- a/tools/testing/kunit/configs/all_tests.config +++ b/tools/testing/kunit/configs/all_tests.config @@ -38,9 +38,6 @@ CONFIG_IWLWIFI=y CONFIG_DAMON=y CONFIG_DAMON_VADDR=y CONFIG_DAMON_PADDR=y -CONFIG_DEBUG_FS=y -CONFIG_DAMON_DBGFS=y -CONFIG_DAMON_DBGFS_DEPRECATED=y CONFIG_REGMAP_BUILD=y From patchwork Tue Oct 15 17:54:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13836806 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 DD32CD1D88F for ; Tue, 15 Oct 2024 17:54:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C59C6B0096; Tue, 15 Oct 2024 13:54:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 24B4A6B0098; Tue, 15 Oct 2024 13:54:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0781F6B0099; Tue, 15 Oct 2024 13:54:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D59206B0096 for ; Tue, 15 Oct 2024 13:54:31 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6376C1A17CE for ; Tue, 15 Oct 2024 17:54:15 +0000 (UTC) X-FDA: 82676586090.06.44025B4 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf25.hostedemail.com (Postfix) with ESMTP id ADBB4A000A for ; Tue, 15 Oct 2024 17:54:24 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=O4lzcSy6; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729014764; a=rsa-sha256; cv=none; b=C0OwCZgFNtG2VG3EqAFJ9gMAa1VzlOUFsPudyzRkY95CWg2mH3ekKCdLNxYQEsbRYfuFrf F7Md4+fisEkqcy7dv0ZeQ2deakK1YKmFf2PPSBecM4YG8SUpAIpM4kJKcsyyX+tZZphk+8 EYKCuFek7RoZd7xiOaZmAbtlG2cDYag= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=O4lzcSy6; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 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=1729014764; 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=YbQj1LfW8wIMlDtW04KsmgNArcZ6QLpc8f+8GRDflTo=; b=K3oc3Fkk0S5uuofRcM0djoxV+tY+Ucg64Nar6hQVL0q1L4cKKwi4p49YLYPodSdMHG2b8s o89z0GnQXtp+AJOxvaaV9R/PV8Y9ESFfKyZIdKqSreov6osoMBMgWDKtmmrdHxetQFjTap JL2AwPtDTCYH20kLPEU235TTYw8E45M= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id EDC5DA42608; Tue, 15 Oct 2024 17:54:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35735C4CED5; Tue, 15 Oct 2024 17:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729014868; bh=+5y1um4gitXtylrMffYca0ktxuX6uSb/9QDvMPQdSFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O4lzcSy6i79Wom+pv+6s2P2i6bYMcG7Nytm2ZVcIpvbvyj4OzDLielOBUIofnAKNF U7OWoBscoDYa5BrM03l8S593Wc8K+kuK8b5LjpVqNaFq9Dt2CvvQjeazjbhNdPTJ+P e/HoNuKk6YdF6WmHd+YdwGC5BfPk0Opt7HVeq9cakKqLRgx+tY6I1URfS63q73dBIz dDDHU7s6PovCqRo5CK/9wY8VHtWNJiVhGQA3u1/VZW0s31VUMZJY+W1Usz5xBW9Hn2 bW4FAmQ5Vrd7LPLEOyCplGqU4aNnVCG97BRUJE+vfUQNLY6+Krt5viH/WZn6w3nU4+ GnLLUsIxV676Q== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Brendan Higgins , David Gow , damon@lists.linux.dev, linux-mm@kvack.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 6/7] mm/damon: remove DAMON debugfs interface kunit tests Date: Tue, 15 Oct 2024 10:54:11 -0700 Message-Id: <20241015175412.60563-7-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241015175412.60563-1-sj@kernel.org> References: <20241015175412.60563-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: ADBB4A000A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: n3zoa8ogkf7t18smsaiupr9rj8e6m7g4 X-HE-Tag: 1729014864-265706 X-HE-Meta: U2FsdGVkX19h1Bf3T22X5aFj+J1oog4cQhOEPEwh4W1kUvNbdpLEXOVUypXF0OrKoKyl6xiOc/bocCzod7QslAEyI6MIfeyqz4CDfnN1v23SPJv7TazEGu7yyWKYlcbrk18G8vv+SaRN0nrs2Bf0tvPKcaXwHqyr9vL5va3+y7vTybNLfKD/Ps3pdh1RTFJkykQ85XFH3gUpuZ97mMW5Sq/mvJ8J5AKZvJr8JEXzNTIYroUvV/WkLfmvU1luZiLKTWZF/W/REh5nyXmsQr7+5PCesQMfRTgiQO96zusihxVohtKd/eN2RjK+c/RJhBX4dO68cVg4Xai2wDRi0G7m3J/+k/Ven3yLoUihoCWFdZ5WFnk7dNVFTabkiKTsQVNGPaRbnVT3Yk2KLeL9OK/ZdprbZsfG1CNZrafw4bl0m4EhNQ0MQkZY1VBRXiMw7bqqWQcoj/pa8NdTfcsSIAHST4HSpQzH8nfs6Mhs8Uv8EuyWrf6gTS7X7A6UG0/zWoVKmawT/nYHUojMl5KlUeVxuw77mBxo8Na8Bn4NCDkz3P1UatS05Y37+JXslRjZNShnp8WpUIQsKkEGQnoeQYjTnTqipV+7Hq+4iTWh+9TMLgfYEUd8B2T46EsK3WnEo4h0LxcXI0gGz0qd0ptvAGuglbVcQfhuiyTRXIoFcrKYrEv/urJn/vGBAeIOa71WEH8dBJnObKOF6URzKNmZ1jFaFrHjTH05FYUxbn1LxKzTaoCk855fizpgoxYwGc0wqIzfasbuMHFZQfziBq+OzJetJ8ald9/8dG3iit66DqlItUqvJheMJBdyGciQNkZADP0E41Vmfrmw/4ujpN5Y7pA/I1gB3gsHrngCTdEdMHVDHBtW3/AvsV4oOy0FKcX5p1A8EZ4v1SwDwrenfBZnH6x/BNZPVjc7WvY8VphZ70l5sIftAb+sAQzLsSyB2b/OxHL2beNbcNXtsXguZ/GMy6W QH4UU/DC 0xxNEDBG/t0tOkyDB8jOgANmJE7g+JVXIIdcaa1g3BKvn0xZmHqs0MyZCMvPcvjdFChZaEUjtlOsHgaH5MibValCtefHw0iLzG5QG1V2x1NaF3Ar1jZFiDVXiWaEaVhcoY4kZNVZRcWHZm7QNwasVR8fc+ygJWKP4sh+2AlWY5p/U3VwCegQhhto/LZqAxyMYtgObYot/080ykEouATzdu0xjJvsNUXwg3naxrocegB0S9T4= 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: List-Subscribe: List-Unsubscribe: It's time to remove DAMON debugfs interface, which has deprecated long before in February 2023. Read the cover letter of this patch series for more details. Remove kunit tests for the interface, to prevent unnecessary test failures. Signed-off-by: SeongJae Park --- mm/damon/Kconfig | 12 --- mm/damon/dbgfs.c | 2 - mm/damon/tests/.kunitconfig | 7 -- mm/damon/tests/dbgfs-kunit.h | 173 ----------------------------------- 4 files changed, 194 deletions(-) delete mode 100644 mm/damon/tests/dbgfs-kunit.h diff --git a/mm/damon/Kconfig b/mm/damon/Kconfig index 35b72f88983a..5ee5e62c0a1e 100644 --- a/mm/damon/Kconfig +++ b/mm/damon/Kconfig @@ -89,18 +89,6 @@ config DAMON_DBGFS default y depends on DAMON_DBGFS_DEPRECATED -config DAMON_DBGFS_KUNIT_TEST - bool "Test for damon debugfs interface" if !KUNIT_ALL_TESTS - depends on DAMON_DBGFS && KUNIT=y - default KUNIT_ALL_TESTS - help - This builds the DAMON debugfs interface Kunit test suite. - - For more information on KUnit and unit tests in general, please refer - to the KUnit documentation. - - If unsure, say N. - config DAMON_RECLAIM bool "Build DAMON-based reclaim (DAMON_RECLAIM)" depends on DAMON_PADDR diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c index b4213bc47e44..5664c2cb0a5e 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -1144,5 +1144,3 @@ static int __init damon_dbgfs_init(void) } module_init(damon_dbgfs_init); - -#include "tests/dbgfs-kunit.h" diff --git a/mm/damon/tests/.kunitconfig b/mm/damon/tests/.kunitconfig index a73be044fc9b..36a450f57b58 100644 --- a/mm/damon/tests/.kunitconfig +++ b/mm/damon/tests/.kunitconfig @@ -13,10 +13,3 @@ CONFIG_DAMON_VADDR_KUNIT_TEST=y CONFIG_SYSFS=y CONFIG_DAMON_SYSFS=y CONFIG_DAMON_SYSFS_KUNIT_TEST=y - -# for DAMON debugfs interface -CONFIG_DEBUG_FS=y -CONFIG_DAMON_PADDR=y -CONFIG_DAMON_DBGFS_DEPRECATED=y -CONFIG_DAMON_DBGFS=y -CONFIG_DAMON_DBGFS_KUNIT_TEST=y diff --git a/mm/damon/tests/dbgfs-kunit.h b/mm/damon/tests/dbgfs-kunit.h deleted file mode 100644 index d2ecfcc8db86..000000000000 --- a/mm/damon/tests/dbgfs-kunit.h +++ /dev/null @@ -1,173 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * DAMON Debugfs Interface Unit Tests - * - * Author: SeongJae Park - */ - -#ifdef CONFIG_DAMON_DBGFS_KUNIT_TEST - -#ifndef _DAMON_DBGFS_TEST_H -#define _DAMON_DBGFS_TEST_H - -#include - -static void damon_dbgfs_test_str_to_ints(struct kunit *test) -{ - char *question; - int *answers; - int expected[] = {12, 35, 46}; - ssize_t nr_integers = 0, i; - - question = "123"; - answers = str_to_ints(question, strlen(question), &nr_integers); - KUNIT_EXPECT_EQ(test, (ssize_t)1, nr_integers); - KUNIT_EXPECT_EQ(test, 123, answers[0]); - kfree(answers); - - question = "123abc"; - answers = str_to_ints(question, strlen(question), &nr_integers); - KUNIT_EXPECT_EQ(test, (ssize_t)1, nr_integers); - KUNIT_EXPECT_EQ(test, 123, answers[0]); - kfree(answers); - - question = "a123"; - answers = str_to_ints(question, strlen(question), &nr_integers); - KUNIT_EXPECT_EQ(test, (ssize_t)0, nr_integers); - kfree(answers); - - question = "12 35"; - answers = str_to_ints(question, strlen(question), &nr_integers); - KUNIT_EXPECT_EQ(test, (ssize_t)2, nr_integers); - for (i = 0; i < nr_integers; i++) - KUNIT_EXPECT_EQ(test, expected[i], answers[i]); - kfree(answers); - - question = "12 35 46"; - answers = str_to_ints(question, strlen(question), &nr_integers); - KUNIT_EXPECT_EQ(test, (ssize_t)3, nr_integers); - for (i = 0; i < nr_integers; i++) - KUNIT_EXPECT_EQ(test, expected[i], answers[i]); - kfree(answers); - - question = "12 35 abc 46"; - answers = str_to_ints(question, strlen(question), &nr_integers); - KUNIT_EXPECT_EQ(test, (ssize_t)2, nr_integers); - for (i = 0; i < 2; i++) - KUNIT_EXPECT_EQ(test, expected[i], answers[i]); - kfree(answers); - - question = ""; - answers = str_to_ints(question, strlen(question), &nr_integers); - KUNIT_EXPECT_EQ(test, (ssize_t)0, nr_integers); - kfree(answers); - - question = "\n"; - answers = str_to_ints(question, strlen(question), &nr_integers); - KUNIT_EXPECT_EQ(test, (ssize_t)0, nr_integers); - kfree(answers); -} - -static void damon_dbgfs_test_set_targets(struct kunit *test) -{ - struct damon_ctx *ctx = dbgfs_new_ctx(); - char buf[64]; - - if (!damon_is_registered_ops(DAMON_OPS_PADDR)) { - dbgfs_destroy_ctx(ctx); - kunit_skip(test, "PADDR not registered"); - } - - /* Make DAMON consider target has no pid */ - damon_select_ops(ctx, DAMON_OPS_PADDR); - - dbgfs_set_targets(ctx, 0, NULL); - sprint_target_ids(ctx, buf, 64); - KUNIT_EXPECT_STREQ(test, (char *)buf, "\n"); - - dbgfs_set_targets(ctx, 1, NULL); - sprint_target_ids(ctx, buf, 64); - KUNIT_EXPECT_STREQ(test, (char *)buf, "42\n"); - - dbgfs_set_targets(ctx, 0, NULL); - sprint_target_ids(ctx, buf, 64); - KUNIT_EXPECT_STREQ(test, (char *)buf, "\n"); - - dbgfs_destroy_ctx(ctx); -} - -static void damon_dbgfs_test_set_init_regions(struct kunit *test) -{ - struct damon_ctx *ctx = damon_new_ctx(); - /* Each line represents one region in `` `` */ - char * const valid_inputs[] = {"1 10 20\n 1 20 30\n1 35 45", - "1 10 20\n", - "1 10 20\n0 39 59\n0 70 134\n 1 20 25\n", - ""}; - /* Reading the file again will show sorted, clean output */ - char * const valid_expects[] = {"1 10 20\n1 20 30\n1 35 45\n", - "1 10 20\n", - "0 39 59\n0 70 134\n1 10 20\n1 20 25\n", - ""}; - char * const invalid_inputs[] = {"3 10 20\n", /* target not exists */ - "1 10 20\n 1 14 26\n", /* regions overlap */ - "0 10 20\n1 30 40\n 0 5 8"}; /* not sorted by address */ - char *input, *expect; - int i, rc; - char buf[256]; - - if (!damon_is_registered_ops(DAMON_OPS_PADDR)) { - damon_destroy_ctx(ctx); - kunit_skip(test, "PADDR not registered"); - } - - damon_select_ops(ctx, DAMON_OPS_PADDR); - - dbgfs_set_targets(ctx, 3, NULL); - - /* Put valid inputs and check the results */ - for (i = 0; i < ARRAY_SIZE(valid_inputs); i++) { - input = valid_inputs[i]; - expect = valid_expects[i]; - - rc = set_init_regions(ctx, input, strnlen(input, 256)); - KUNIT_EXPECT_EQ(test, rc, 0); - - memset(buf, 0, 256); - sprint_init_regions(ctx, buf, 256); - - KUNIT_EXPECT_STREQ(test, (char *)buf, expect); - } - /* Put invalid inputs and check the return error code */ - for (i = 0; i < ARRAY_SIZE(invalid_inputs); i++) { - input = invalid_inputs[i]; - pr_info("input: %s\n", input); - rc = set_init_regions(ctx, input, strnlen(input, 256)); - KUNIT_EXPECT_EQ(test, rc, -EINVAL); - - memset(buf, 0, 256); - sprint_init_regions(ctx, buf, 256); - - KUNIT_EXPECT_STREQ(test, (char *)buf, ""); - } - - dbgfs_set_targets(ctx, 0, NULL); - damon_destroy_ctx(ctx); -} - -static struct kunit_case damon_test_cases[] = { - KUNIT_CASE(damon_dbgfs_test_str_to_ints), - KUNIT_CASE(damon_dbgfs_test_set_targets), - KUNIT_CASE(damon_dbgfs_test_set_init_regions), - {}, -}; - -static struct kunit_suite damon_test_suite = { - .name = "damon-dbgfs", - .test_cases = damon_test_cases, -}; -kunit_test_suite(damon_test_suite); - -#endif /* _DAMON_TEST_H */ - -#endif /* CONFIG_DAMON_KUNIT_TEST */ From patchwork Tue Oct 15 17:54:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13836807 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 CBEFBD1D88B for ; Tue, 15 Oct 2024 17:54:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55CA46B0098; Tue, 15 Oct 2024 13:54:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BDD26B009A; Tue, 15 Oct 2024 13:54:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24B636B009B; Tue, 15 Oct 2024 13:54:33 -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 ED9726B0098 for ; Tue, 15 Oct 2024 13:54:32 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C24D5AC2F1 for ; Tue, 15 Oct 2024 17:54:14 +0000 (UTC) X-FDA: 82676586174.22.DB64B2B Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf29.hostedemail.com (Postfix) with ESMTP id EA16B120014 for ; Tue, 15 Oct 2024 17:54:20 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=i2p7ZHBd; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729014765; a=rsa-sha256; cv=none; b=AcehNRFbkVNmPJmy8vbH2YVuPAaQCm6nsdIpXE/FApyP7h1UX0J5icasD2U4sktWPaj38j DwsG/9oNaf8da/pQp+RD8Uk8ZTI1tcKS7rVrSCU7h5sklycx6CPOlC+9M+8Q8++AIWXVwc QYWrMi/OEbWMwjtg4+VVpB/0Y5rrnwk= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=i2p7ZHBd; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 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=1729014765; 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=nclj6ZV/F/89JDBV0E6ZgoHSP2lVZXH4ut6VKNXfQTo=; b=Zrj2bzVXsFoiHHe3BMUUhuMpZoctZKrBF8U0PqEJzj6H9xSDvAHFt82dtLV1FkkGAp83Tw /yEo8YVw7ksuisTLIFhq4/RvaDvhXpJUfL0Cz2Cs2Ro5+dZDIXJ3b82po81mufcQr9iaAt X97G0rJV343YBe9UGwZMBKeREb9r80E= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id E727FA433FD; Tue, 15 Oct 2024 17:54:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58577C4CED5; Tue, 15 Oct 2024 17:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729014869; bh=DqgLfLKxAdQeHSBwaqJNenexXfcRykZ+0OrFMpJb/qs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i2p7ZHBdEXuFZtlTdeCwG9mBEgH+k1BzYLZpIHgvGNEjylv5OS0d9ChU5s0CbX9Sp u2kQ7nAYRfIojiFKCvIHTRtnJw4/aqFCcddWsRWu5yqL7yt4j6ho6hIREWFjHOtMD0 xzvMzK7ynVd6g0+cy4BLGmOyl8twySogco8ENVKb39AEIRPOdpbA9BOvbPP0WnVli2 4OKg0s2QcGVBy7ueqHnWr4xd/7i++hdX8Oseqj+3zGeQS+wJU0y1/cwlkb5gKl5hS2 WEf+nZf1FEqUFGJmevkAgLi9TIQSh0WPVsbeijQBXFx4Lp30OaNg52AjwOpPNcKVNT UCmDeZkNIRIXA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 7/7] mm/damon: remove DAMON debugfs interface Date: Tue, 15 Oct 2024 10:54:12 -0700 Message-Id: <20241015175412.60563-8-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241015175412.60563-1-sj@kernel.org> References: <20241015175412.60563-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: EA16B120014 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: d4d6k1m4r1d8uwj1hixrezuo7jiheiju X-HE-Tag: 1729014860-631144 X-HE-Meta: U2FsdGVkX1+UECtYPYkmGepuIc3Al332kyrx2R6pVw14VZ9kasDENvH9PdYvPeeTLxoy+DcloTkmG1PkwBEtl82b4xvMauBve4a+Jf8LiqhBSaIO57i48mVH+UiW43PFpAWhv7NFm+ANa2oe1izWUS60pfyBR0M8zHI/8BAaxJny196WvG8E17yZ6TW4G/+HICGgFkaStzJXOGdcx4E5yCi1XGf8JB3S01+pnfUd5jVZ2S8r2PnQvPAqcaPXDRLF91CtJHGnUutMTubwcqkMzWPzqSoYCcsxkSdbemUkIR245CzfNksAC+FlKU70SEhWQOa9CiSbBAyE+fLhkYN0qHT/gL3nS9gqPLBkqYwetcBaK66vkcdezT0qg38P2M+JWvCg4iVjt7ZcKFwQIEZEjTLjJ2UeS4Bfr/uzmEc+jmZiCzTWkqZrfOpoisGpJMw2j2W29RTJxh8IsAIkj7h4Mdbx0las4N9hoCv9HhCGwcJ9A1iIybIJCZg3dIXQfFGz7jEZEZmzMVy/Nac7nqwIdoY0qim0RB6jV1jBy7Um3adtpnxJIdfxzyA7hSdveeMQtnmyrcuhHAujb3xHpJePvAzGzxNSzR2zWIX3LV0Ycr7c6Pa54J/MByg3o4WpAacJjIWjuCgInQoGnDhJV7qrit1n924ztWCTYxHOzcQr+5IKDSkur5ikQtBFNWO/TrE24HmpbA0wJUTWi5VfYEPiQEMLYj1vOCJUMt0ludyK8AYNr0SnsuHtZTHec0+dbsYlY/DBqCWtTGDQjFZUItQ4tECu8FpuZlJiXHusgigPWtiQt/quDTsTMtzhy0uAVgA24vXeTSATP+opX9r/xGdmMhMmu96lVoAle/DoysJrGT4EGxDg/Dxsb2pSeRBFJi+tqJogBXs3CmKkOJWGnWs9/9pJ+z6QkhTzhVmVxqtiqpsE/aXgsXg/jhmldkQl9q3daFwc64djXXalYXxHPFn UPt+Aq6D Svnuk7jYUfAK4qeChC0Q1qm8eg9YnYelQhY0GdeMQSMHSpZI/ucCVUzsQRKRkGB8RzUialkcd2od9SIP8wkwxPTCoFcWg/si+QOZMElSSa50/ukgPedkK6qC9WO/g3feNp5rVHM7mOfciTAGj2FjLkKpkgYsShwQldxjSDeNB7Eza5dC0Tt/DPNBkV78oZvQcY4SNy2nIiP9u7kQVYAVL98AKCoUJmo2iOugU+htWRRTSPfsVBdEfTZ4CkMDntFPgwFBBuuhdR1flLbfL5t0DG2s75O0Fy3GHAPxx 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: List-Subscribe: List-Unsubscribe: It's time to remove DAMON debugfs interface, which has deprecated long before in February 2023. Read the cover letter of this patch series for more details. All documents and related tests are also removed. Finally remove the interface. Signed-off-by: SeongJae Park --- mm/damon/Kconfig | 18 - mm/damon/Makefile | 1 - mm/damon/dbgfs.c | 1146 --------------------------------------------- 3 files changed, 1165 deletions(-) delete mode 100644 mm/damon/dbgfs.c diff --git a/mm/damon/Kconfig b/mm/damon/Kconfig index 5ee5e62c0a1e..1cc1cb5ba66f 100644 --- a/mm/damon/Kconfig +++ b/mm/damon/Kconfig @@ -71,24 +71,6 @@ config DAMON_SYSFS_KUNIT_TEST If unsure, say N. -config DAMON_DBGFS_DEPRECATED - bool "DAMON debugfs interface (DEPRECATED!)" - depends on DAMON_VADDR && DAMON_PADDR && DEBUG_FS - help - This builds the debugfs interface for DAMON. The user space admins - can use the interface for arbitrary data access monitoring. - - If unsure, say N. - - This is deprecated, so users should move to the sysfs interface - (DAMON_SYSFS). If you depend on this and cannot move, please report - your usecase to damon@lists.linux.dev and linux-mm@kvack.org. - -config DAMON_DBGFS - bool - default y - depends on DAMON_DBGFS_DEPRECATED - config DAMON_RECLAIM bool "Build DAMON-based reclaim (DAMON_RECLAIM)" depends on DAMON_PADDR diff --git a/mm/damon/Makefile b/mm/damon/Makefile index f7add3f4aa79..8b49012ba8c3 100644 --- a/mm/damon/Makefile +++ b/mm/damon/Makefile @@ -4,6 +4,5 @@ obj-y := core.o obj-$(CONFIG_DAMON_VADDR) += ops-common.o vaddr.o obj-$(CONFIG_DAMON_PADDR) += ops-common.o paddr.o obj-$(CONFIG_DAMON_SYSFS) += sysfs-common.o sysfs-schemes.o sysfs.o -obj-$(CONFIG_DAMON_DBGFS) += dbgfs.o obj-$(CONFIG_DAMON_RECLAIM) += modules-common.o reclaim.o obj-$(CONFIG_DAMON_LRU_SORT) += modules-common.o lru_sort.o diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c deleted file mode 100644 index 5664c2cb0a5e..000000000000 --- a/mm/damon/dbgfs.c +++ /dev/null @@ -1,1146 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * DAMON Debugfs Interface - * - * Author: SeongJae Park - */ - -#define pr_fmt(fmt) "damon-dbgfs: " fmt - -#include -#include -#include -#include -#include -#include -#include - -#define DAMON_DBGFS_DEPRECATION_NOTICE \ - "DAMON debugfs interface is deprecated, so users should move " \ - "to DAMON_SYSFS. If you cannot, please report your usecase to " \ - "damon@lists.linux.dev and linux-mm@kvack.org.\n" - -static struct damon_ctx **dbgfs_ctxs; -static int dbgfs_nr_ctxs; -static struct dentry **dbgfs_dirs; -static DEFINE_MUTEX(damon_dbgfs_lock); - -static void damon_dbgfs_warn_deprecation(void) -{ - pr_warn_once(DAMON_DBGFS_DEPRECATION_NOTICE); -} - -/* - * Returns non-empty string on success, negative error code otherwise. - */ -static char *user_input_str(const char __user *buf, size_t count, loff_t *ppos) -{ - char *kbuf; - ssize_t ret; - - /* We do not accept continuous write */ - if (*ppos) - return ERR_PTR(-EINVAL); - - kbuf = kmalloc(count + 1, GFP_KERNEL | __GFP_NOWARN); - if (!kbuf) - return ERR_PTR(-ENOMEM); - - ret = simple_write_to_buffer(kbuf, count + 1, ppos, buf, count); - if (ret != count) { - kfree(kbuf); - return ERR_PTR(-EIO); - } - kbuf[ret] = '\0'; - - return kbuf; -} - -static ssize_t dbgfs_attrs_read(struct file *file, - char __user *buf, size_t count, loff_t *ppos) -{ - struct damon_ctx *ctx = file->private_data; - char kbuf[128]; - int ret; - - mutex_lock(&ctx->kdamond_lock); - ret = scnprintf(kbuf, ARRAY_SIZE(kbuf), "%lu %lu %lu %lu %lu\n", - ctx->attrs.sample_interval, ctx->attrs.aggr_interval, - ctx->attrs.ops_update_interval, - ctx->attrs.min_nr_regions, ctx->attrs.max_nr_regions); - mutex_unlock(&ctx->kdamond_lock); - - return simple_read_from_buffer(buf, count, ppos, kbuf, ret); -} - -static ssize_t dbgfs_attrs_write(struct file *file, - const char __user *buf, size_t count, loff_t *ppos) -{ - struct damon_ctx *ctx = file->private_data; - struct damon_attrs attrs; - char *kbuf; - ssize_t ret; - - kbuf = user_input_str(buf, count, ppos); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); - - if (sscanf(kbuf, "%lu %lu %lu %lu %lu", - &attrs.sample_interval, &attrs.aggr_interval, - &attrs.ops_update_interval, - &attrs.min_nr_regions, - &attrs.max_nr_regions) != 5) { - ret = -EINVAL; - goto out; - } - - mutex_lock(&ctx->kdamond_lock); - if (ctx->kdamond) { - ret = -EBUSY; - goto unlock_out; - } - - ret = damon_set_attrs(ctx, &attrs); - if (!ret) - ret = count; -unlock_out: - mutex_unlock(&ctx->kdamond_lock); -out: - kfree(kbuf); - return ret; -} - -/* - * Return corresponding dbgfs' scheme action value (int) for the given - * damos_action if the given damos_action value is valid and supported by - * dbgfs, negative error code otherwise. - */ -static int damos_action_to_dbgfs_scheme_action(enum damos_action action) -{ - switch (action) { - case DAMOS_WILLNEED: - return 0; - case DAMOS_COLD: - return 1; - case DAMOS_PAGEOUT: - return 2; - case DAMOS_HUGEPAGE: - return 3; - case DAMOS_NOHUGEPAGE: - return 4; - case DAMOS_STAT: - return 5; - default: - return -EINVAL; - } -} - -static ssize_t sprint_schemes(struct damon_ctx *c, char *buf, ssize_t len) -{ - struct damos *s; - int written = 0; - int rc; - - damon_for_each_scheme(s, c) { - rc = scnprintf(&buf[written], len - written, - "%lu %lu %u %u %u %u %d %lu %lu %lu %u %u %u %d %lu %lu %lu %lu %lu %lu %lu %lu %lu\n", - s->pattern.min_sz_region, - s->pattern.max_sz_region, - s->pattern.min_nr_accesses, - s->pattern.max_nr_accesses, - s->pattern.min_age_region, - s->pattern.max_age_region, - damos_action_to_dbgfs_scheme_action(s->action), - s->quota.ms, s->quota.sz, - s->quota.reset_interval, - s->quota.weight_sz, - s->quota.weight_nr_accesses, - s->quota.weight_age, - s->wmarks.metric, s->wmarks.interval, - s->wmarks.high, s->wmarks.mid, s->wmarks.low, - s->stat.nr_tried, s->stat.sz_tried, - s->stat.nr_applied, s->stat.sz_applied, - s->stat.qt_exceeds); - if (!rc) - return -ENOMEM; - - written += rc; - } - return written; -} - -static ssize_t dbgfs_schemes_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) -{ - struct damon_ctx *ctx = file->private_data; - char *kbuf; - ssize_t len; - - kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); - if (!kbuf) - return -ENOMEM; - - mutex_lock(&ctx->kdamond_lock); - len = sprint_schemes(ctx, kbuf, count); - mutex_unlock(&ctx->kdamond_lock); - if (len < 0) - goto out; - len = simple_read_from_buffer(buf, count, ppos, kbuf, len); - -out: - kfree(kbuf); - return len; -} - -static void free_schemes_arr(struct damos **schemes, ssize_t nr_schemes) -{ - ssize_t i; - - for (i = 0; i < nr_schemes; i++) - kfree(schemes[i]); - kfree(schemes); -} - -/* - * Return corresponding damos_action for the given dbgfs input for a scheme - * action if the input is valid, negative error code otherwise. - */ -static enum damos_action dbgfs_scheme_action_to_damos_action(int dbgfs_action) -{ - switch (dbgfs_action) { - case 0: - return DAMOS_WILLNEED; - case 1: - return DAMOS_COLD; - case 2: - return DAMOS_PAGEOUT; - case 3: - return DAMOS_HUGEPAGE; - case 4: - return DAMOS_NOHUGEPAGE; - case 5: - return DAMOS_STAT; - default: - return -EINVAL; - } -} - -/* - * Converts a string into an array of struct damos pointers - * - * Returns an array of struct damos pointers that converted if the conversion - * success, or NULL otherwise. - */ -static struct damos **str_to_schemes(const char *str, ssize_t len, - ssize_t *nr_schemes) -{ - struct damos *scheme, **schemes; - const int max_nr_schemes = 256; - int pos = 0, parsed, ret; - unsigned int action_input; - enum damos_action action; - - schemes = kmalloc_array(max_nr_schemes, sizeof(scheme), - GFP_KERNEL); - if (!schemes) - return NULL; - - *nr_schemes = 0; - while (pos < len && *nr_schemes < max_nr_schemes) { - struct damos_access_pattern pattern = {}; - struct damos_quota quota = {}; - struct damos_watermarks wmarks; - - ret = sscanf(&str[pos], - "%lu %lu %u %u %u %u %u %lu %lu %lu %u %u %u %u %lu %lu %lu %lu%n", - &pattern.min_sz_region, &pattern.max_sz_region, - &pattern.min_nr_accesses, - &pattern.max_nr_accesses, - &pattern.min_age_region, - &pattern.max_age_region, - &action_input, "a.ms, - "a.sz, "a.reset_interval, - "a.weight_sz, "a.weight_nr_accesses, - "a.weight_age, &wmarks.metric, - &wmarks.interval, &wmarks.high, &wmarks.mid, - &wmarks.low, &parsed); - if (ret != 18) - break; - action = dbgfs_scheme_action_to_damos_action(action_input); - if ((int)action < 0) - goto fail; - - if (pattern.min_sz_region > pattern.max_sz_region || - pattern.min_nr_accesses > pattern.max_nr_accesses || - pattern.min_age_region > pattern.max_age_region) - goto fail; - - if (wmarks.high < wmarks.mid || wmarks.high < wmarks.low || - wmarks.mid < wmarks.low) - goto fail; - - pos += parsed; - scheme = damon_new_scheme(&pattern, action, 0, "a, - &wmarks, NUMA_NO_NODE); - if (!scheme) - goto fail; - - schemes[*nr_schemes] = scheme; - *nr_schemes += 1; - } - return schemes; -fail: - free_schemes_arr(schemes, *nr_schemes); - return NULL; -} - -static ssize_t dbgfs_schemes_write(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) -{ - struct damon_ctx *ctx = file->private_data; - char *kbuf; - struct damos **schemes; - ssize_t nr_schemes = 0, ret; - - kbuf = user_input_str(buf, count, ppos); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); - - schemes = str_to_schemes(kbuf, count, &nr_schemes); - if (!schemes) { - ret = -EINVAL; - goto out; - } - - mutex_lock(&ctx->kdamond_lock); - if (ctx->kdamond) { - ret = -EBUSY; - goto unlock_out; - } - - damon_set_schemes(ctx, schemes, nr_schemes); - ret = count; - nr_schemes = 0; - -unlock_out: - mutex_unlock(&ctx->kdamond_lock); - free_schemes_arr(schemes, nr_schemes); -out: - kfree(kbuf); - return ret; -} - -static ssize_t sprint_target_ids(struct damon_ctx *ctx, char *buf, ssize_t len) -{ - struct damon_target *t; - int id; - int written = 0; - int rc; - - damon_for_each_target(t, ctx) { - if (damon_target_has_pid(ctx)) - /* Show pid numbers to debugfs users */ - id = pid_vnr(t->pid); - else - /* Show 42 for physical address space, just for fun */ - id = 42; - - rc = scnprintf(&buf[written], len - written, "%d ", id); - if (!rc) - return -ENOMEM; - written += rc; - } - if (written) - written -= 1; - written += scnprintf(&buf[written], len - written, "\n"); - return written; -} - -static ssize_t dbgfs_target_ids_read(struct file *file, - char __user *buf, size_t count, loff_t *ppos) -{ - struct damon_ctx *ctx = file->private_data; - ssize_t len; - char ids_buf[320]; - - mutex_lock(&ctx->kdamond_lock); - len = sprint_target_ids(ctx, ids_buf, 320); - mutex_unlock(&ctx->kdamond_lock); - if (len < 0) - return len; - - return simple_read_from_buffer(buf, count, ppos, ids_buf, len); -} - -/* - * Converts a string into an integers array - * - * Returns an array of integers array if the conversion success, or NULL - * otherwise. - */ -static int *str_to_ints(const char *str, ssize_t len, ssize_t *nr_ints) -{ - int *array; - const int max_nr_ints = 32; - int nr; - int pos = 0, parsed, ret; - - *nr_ints = 0; - array = kmalloc_array(max_nr_ints, sizeof(*array), GFP_KERNEL); - if (!array) - return NULL; - while (*nr_ints < max_nr_ints && pos < len) { - ret = sscanf(&str[pos], "%d%n", &nr, &parsed); - pos += parsed; - if (ret != 1) - break; - array[*nr_ints] = nr; - *nr_ints += 1; - } - - return array; -} - -static void dbgfs_put_pids(struct pid **pids, int nr_pids) -{ - int i; - - for (i = 0; i < nr_pids; i++) - put_pid(pids[i]); -} - -/* - * Converts a string into an struct pid pointers array - * - * Returns an array of struct pid pointers if the conversion success, or NULL - * otherwise. - */ -static struct pid **str_to_pids(const char *str, ssize_t len, ssize_t *nr_pids) -{ - int *ints; - ssize_t nr_ints; - struct pid **pids; - - *nr_pids = 0; - - ints = str_to_ints(str, len, &nr_ints); - if (!ints) - return NULL; - - pids = kmalloc_array(nr_ints, sizeof(*pids), GFP_KERNEL); - if (!pids) - goto out; - - for (; *nr_pids < nr_ints; (*nr_pids)++) { - pids[*nr_pids] = find_get_pid(ints[*nr_pids]); - if (!pids[*nr_pids]) { - dbgfs_put_pids(pids, *nr_pids); - kfree(ints); - kfree(pids); - return NULL; - } - } - -out: - kfree(ints); - return pids; -} - -/* - * dbgfs_set_targets() - Set monitoring targets. - * @ctx: monitoring context - * @nr_targets: number of targets - * @pids: array of target pids (size is same to @nr_targets) - * - * This function should not be called while the kdamond is running. @pids is - * ignored if the context is not configured to have pid in each target. On - * failure, reference counts of all pids in @pids are decremented. - * - * Return: 0 on success, negative error code otherwise. - */ -static int dbgfs_set_targets(struct damon_ctx *ctx, ssize_t nr_targets, - struct pid **pids) -{ - ssize_t i; - struct damon_target *t, *next; - - damon_for_each_target_safe(t, next, ctx) { - if (damon_target_has_pid(ctx)) - put_pid(t->pid); - damon_destroy_target(t); - } - - for (i = 0; i < nr_targets; i++) { - t = damon_new_target(); - if (!t) { - damon_for_each_target_safe(t, next, ctx) - damon_destroy_target(t); - if (damon_target_has_pid(ctx)) - dbgfs_put_pids(pids, nr_targets); - return -ENOMEM; - } - if (damon_target_has_pid(ctx)) - t->pid = pids[i]; - damon_add_target(ctx, t); - } - - return 0; -} - -static ssize_t dbgfs_target_ids_write(struct file *file, - const char __user *buf, size_t count, loff_t *ppos) -{ - struct damon_ctx *ctx = file->private_data; - bool id_is_pid = true; - char *kbuf; - struct pid **target_pids = NULL; - ssize_t nr_targets; - ssize_t ret; - - kbuf = user_input_str(buf, count, ppos); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); - - if (!strncmp(kbuf, "paddr\n", count)) { - id_is_pid = false; - nr_targets = 1; - } - - if (id_is_pid) { - target_pids = str_to_pids(kbuf, count, &nr_targets); - if (!target_pids) { - ret = -ENOMEM; - goto out; - } - } - - mutex_lock(&ctx->kdamond_lock); - if (ctx->kdamond) { - if (id_is_pid) - dbgfs_put_pids(target_pids, nr_targets); - ret = -EBUSY; - goto unlock_out; - } - - /* remove previously set targets */ - dbgfs_set_targets(ctx, 0, NULL); - if (!nr_targets) { - ret = count; - goto unlock_out; - } - - /* Configure the context for the address space type */ - if (id_is_pid) - ret = damon_select_ops(ctx, DAMON_OPS_VADDR); - else - ret = damon_select_ops(ctx, DAMON_OPS_PADDR); - if (ret) - goto unlock_out; - - ret = dbgfs_set_targets(ctx, nr_targets, target_pids); - if (!ret) - ret = count; - -unlock_out: - mutex_unlock(&ctx->kdamond_lock); - kfree(target_pids); -out: - kfree(kbuf); - return ret; -} - -static ssize_t sprint_init_regions(struct damon_ctx *c, char *buf, ssize_t len) -{ - struct damon_target *t; - struct damon_region *r; - int target_idx = 0; - int written = 0; - int rc; - - damon_for_each_target(t, c) { - damon_for_each_region(r, t) { - rc = scnprintf(&buf[written], len - written, - "%d %lu %lu\n", - target_idx, r->ar.start, r->ar.end); - if (!rc) - return -ENOMEM; - written += rc; - } - target_idx++; - } - return written; -} - -static ssize_t dbgfs_init_regions_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) -{ - struct damon_ctx *ctx = file->private_data; - char *kbuf; - ssize_t len; - - kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); - if (!kbuf) - return -ENOMEM; - - mutex_lock(&ctx->kdamond_lock); - if (ctx->kdamond) { - mutex_unlock(&ctx->kdamond_lock); - len = -EBUSY; - goto out; - } - - len = sprint_init_regions(ctx, kbuf, count); - mutex_unlock(&ctx->kdamond_lock); - if (len < 0) - goto out; - len = simple_read_from_buffer(buf, count, ppos, kbuf, len); - -out: - kfree(kbuf); - return len; -} - -static int add_init_region(struct damon_ctx *c, int target_idx, - struct damon_addr_range *ar) -{ - struct damon_target *t; - struct damon_region *r, *prev; - unsigned long idx = 0; - int rc = -EINVAL; - - if (ar->start >= ar->end) - return -EINVAL; - - damon_for_each_target(t, c) { - if (idx++ == target_idx) { - r = damon_new_region(ar->start, ar->end); - if (!r) - return -ENOMEM; - damon_add_region(r, t); - if (damon_nr_regions(t) > 1) { - prev = damon_prev_region(r); - if (prev->ar.end > r->ar.start) { - damon_destroy_region(r, t); - return -EINVAL; - } - } - rc = 0; - } - } - return rc; -} - -static int set_init_regions(struct damon_ctx *c, const char *str, ssize_t len) -{ - struct damon_target *t; - struct damon_region *r, *next; - int pos = 0, parsed, ret; - int target_idx; - struct damon_addr_range ar; - int err; - - damon_for_each_target(t, c) { - damon_for_each_region_safe(r, next, t) - damon_destroy_region(r, t); - } - - while (pos < len) { - ret = sscanf(&str[pos], "%d %lu %lu%n", - &target_idx, &ar.start, &ar.end, &parsed); - if (ret != 3) - break; - err = add_init_region(c, target_idx, &ar); - if (err) - goto fail; - pos += parsed; - } - - return 0; - -fail: - damon_for_each_target(t, c) { - damon_for_each_region_safe(r, next, t) - damon_destroy_region(r, t); - } - return err; -} - -static ssize_t dbgfs_init_regions_write(struct file *file, - const char __user *buf, size_t count, - loff_t *ppos) -{ - struct damon_ctx *ctx = file->private_data; - char *kbuf; - ssize_t ret = count; - int err; - - kbuf = user_input_str(buf, count, ppos); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); - - mutex_lock(&ctx->kdamond_lock); - if (ctx->kdamond) { - ret = -EBUSY; - goto unlock_out; - } - - err = set_init_regions(ctx, kbuf, ret); - if (err) - ret = err; - -unlock_out: - mutex_unlock(&ctx->kdamond_lock); - kfree(kbuf); - return ret; -} - -static ssize_t dbgfs_kdamond_pid_read(struct file *file, - char __user *buf, size_t count, loff_t *ppos) -{ - struct damon_ctx *ctx = file->private_data; - char *kbuf; - ssize_t len; - - kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); - if (!kbuf) - return -ENOMEM; - - mutex_lock(&ctx->kdamond_lock); - if (ctx->kdamond) - len = scnprintf(kbuf, count, "%d\n", ctx->kdamond->pid); - else - len = scnprintf(kbuf, count, "none\n"); - mutex_unlock(&ctx->kdamond_lock); - if (!len) - goto out; - len = simple_read_from_buffer(buf, count, ppos, kbuf, len); - -out: - kfree(kbuf); - return len; -} - -static int damon_dbgfs_open(struct inode *inode, struct file *file) -{ - damon_dbgfs_warn_deprecation(); - - file->private_data = inode->i_private; - - return nonseekable_open(inode, file); -} - -static const struct file_operations attrs_fops = { - .open = damon_dbgfs_open, - .read = dbgfs_attrs_read, - .write = dbgfs_attrs_write, -}; - -static const struct file_operations schemes_fops = { - .open = damon_dbgfs_open, - .read = dbgfs_schemes_read, - .write = dbgfs_schemes_write, -}; - -static const struct file_operations target_ids_fops = { - .open = damon_dbgfs_open, - .read = dbgfs_target_ids_read, - .write = dbgfs_target_ids_write, -}; - -static const struct file_operations init_regions_fops = { - .open = damon_dbgfs_open, - .read = dbgfs_init_regions_read, - .write = dbgfs_init_regions_write, -}; - -static const struct file_operations kdamond_pid_fops = { - .open = damon_dbgfs_open, - .read = dbgfs_kdamond_pid_read, -}; - -static void dbgfs_fill_ctx_dir(struct dentry *dir, struct damon_ctx *ctx) -{ - const char * const file_names[] = {"attrs", "schemes", "target_ids", - "init_regions", "kdamond_pid"}; - const struct file_operations *fops[] = {&attrs_fops, &schemes_fops, - &target_ids_fops, &init_regions_fops, &kdamond_pid_fops}; - int i; - - for (i = 0; i < ARRAY_SIZE(file_names); i++) - debugfs_create_file(file_names[i], 0600, dir, ctx, fops[i]); -} - -static void dbgfs_before_terminate(struct damon_ctx *ctx) -{ - struct damon_target *t, *next; - - if (!damon_target_has_pid(ctx)) - return; - - mutex_lock(&ctx->kdamond_lock); - damon_for_each_target_safe(t, next, ctx) { - put_pid(t->pid); - damon_destroy_target(t); - } - mutex_unlock(&ctx->kdamond_lock); -} - -static struct damon_ctx *dbgfs_new_ctx(void) -{ - struct damon_ctx *ctx; - - ctx = damon_new_ctx(); - if (!ctx) - return NULL; - - if (damon_select_ops(ctx, DAMON_OPS_VADDR) && - damon_select_ops(ctx, DAMON_OPS_PADDR)) { - damon_destroy_ctx(ctx); - return NULL; - } - ctx->callback.before_terminate = dbgfs_before_terminate; - return ctx; -} - -static void dbgfs_destroy_ctx(struct damon_ctx *ctx) -{ - damon_destroy_ctx(ctx); -} - -static ssize_t damon_dbgfs_deprecated_read(struct file *file, - char __user *buf, size_t count, loff_t *ppos) -{ - static const char kbuf[512] = DAMON_DBGFS_DEPRECATION_NOTICE; - - return simple_read_from_buffer(buf, count, ppos, kbuf, strlen(kbuf)); -} - -/* - * Make a context of @name and create a debugfs directory for it. - * - * This function should be called while holding damon_dbgfs_lock. - * - * Returns 0 on success, negative error code otherwise. - */ -static int dbgfs_mk_context(char *name) -{ - struct dentry *root, **new_dirs, *new_dir; - struct damon_ctx **new_ctxs, *new_ctx; - - if (damon_nr_running_ctxs()) - return -EBUSY; - - new_ctxs = krealloc(dbgfs_ctxs, sizeof(*dbgfs_ctxs) * - (dbgfs_nr_ctxs + 1), GFP_KERNEL); - if (!new_ctxs) - return -ENOMEM; - dbgfs_ctxs = new_ctxs; - - new_dirs = krealloc(dbgfs_dirs, sizeof(*dbgfs_dirs) * - (dbgfs_nr_ctxs + 1), GFP_KERNEL); - if (!new_dirs) - return -ENOMEM; - dbgfs_dirs = new_dirs; - - root = dbgfs_dirs[0]; - if (!root) - return -ENOENT; - - new_dir = debugfs_create_dir(name, root); - /* Below check is required for a potential duplicated name case */ - if (IS_ERR(new_dir)) - return PTR_ERR(new_dir); - dbgfs_dirs[dbgfs_nr_ctxs] = new_dir; - - new_ctx = dbgfs_new_ctx(); - if (!new_ctx) { - debugfs_remove(new_dir); - dbgfs_dirs[dbgfs_nr_ctxs] = NULL; - return -ENOMEM; - } - - dbgfs_ctxs[dbgfs_nr_ctxs] = new_ctx; - dbgfs_fill_ctx_dir(dbgfs_dirs[dbgfs_nr_ctxs], - dbgfs_ctxs[dbgfs_nr_ctxs]); - dbgfs_nr_ctxs++; - - return 0; -} - -static ssize_t dbgfs_mk_context_write(struct file *file, - const char __user *buf, size_t count, loff_t *ppos) -{ - char *kbuf; - char *ctx_name; - ssize_t ret; - - kbuf = user_input_str(buf, count, ppos); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); - ctx_name = kmalloc(count + 1, GFP_KERNEL); - if (!ctx_name) { - kfree(kbuf); - return -ENOMEM; - } - - /* Trim white space */ - if (sscanf(kbuf, "%s", ctx_name) != 1) { - ret = -EINVAL; - goto out; - } - - mutex_lock(&damon_dbgfs_lock); - ret = dbgfs_mk_context(ctx_name); - if (!ret) - ret = count; - mutex_unlock(&damon_dbgfs_lock); - -out: - kfree(kbuf); - kfree(ctx_name); - return ret; -} - -/* - * Remove a context of @name and its debugfs directory. - * - * This function should be called while holding damon_dbgfs_lock. - * - * Return 0 on success, negative error code otherwise. - */ -static int dbgfs_rm_context(char *name) -{ - struct dentry *root, *dir, **new_dirs; - struct inode *inode; - struct damon_ctx **new_ctxs; - int i, j; - int ret = 0; - - if (damon_nr_running_ctxs()) - return -EBUSY; - - root = dbgfs_dirs[0]; - if (!root) - return -ENOENT; - - dir = debugfs_lookup(name, root); - if (!dir) - return -ENOENT; - - inode = d_inode(dir); - if (!S_ISDIR(inode->i_mode)) { - ret = -EINVAL; - goto out_dput; - } - - new_dirs = kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_dirs), - GFP_KERNEL); - if (!new_dirs) { - ret = -ENOMEM; - goto out_dput; - } - - new_ctxs = kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_ctxs), - GFP_KERNEL); - if (!new_ctxs) { - ret = -ENOMEM; - goto out_new_dirs; - } - - for (i = 0, j = 0; i < dbgfs_nr_ctxs; i++) { - if (dbgfs_dirs[i] == dir) { - debugfs_remove(dbgfs_dirs[i]); - dbgfs_destroy_ctx(dbgfs_ctxs[i]); - continue; - } - new_dirs[j] = dbgfs_dirs[i]; - new_ctxs[j++] = dbgfs_ctxs[i]; - } - - kfree(dbgfs_dirs); - kfree(dbgfs_ctxs); - - dbgfs_dirs = new_dirs; - dbgfs_ctxs = new_ctxs; - dbgfs_nr_ctxs--; - - goto out_dput; - -out_new_dirs: - kfree(new_dirs); -out_dput: - dput(dir); - return ret; -} - -static ssize_t dbgfs_rm_context_write(struct file *file, - const char __user *buf, size_t count, loff_t *ppos) -{ - char *kbuf; - ssize_t ret; - char *ctx_name; - - kbuf = user_input_str(buf, count, ppos); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); - ctx_name = kmalloc(count + 1, GFP_KERNEL); - if (!ctx_name) { - kfree(kbuf); - return -ENOMEM; - } - - /* Trim white space */ - if (sscanf(kbuf, "%s", ctx_name) != 1) { - ret = -EINVAL; - goto out; - } - - mutex_lock(&damon_dbgfs_lock); - ret = dbgfs_rm_context(ctx_name); - if (!ret) - ret = count; - mutex_unlock(&damon_dbgfs_lock); - -out: - kfree(kbuf); - kfree(ctx_name); - return ret; -} - -static ssize_t dbgfs_monitor_on_read(struct file *file, - char __user *buf, size_t count, loff_t *ppos) -{ - char monitor_on_buf[5]; - bool monitor_on = damon_nr_running_ctxs() != 0; - int len; - - len = scnprintf(monitor_on_buf, 5, monitor_on ? "on\n" : "off\n"); - - return simple_read_from_buffer(buf, count, ppos, monitor_on_buf, len); -} - -static ssize_t dbgfs_monitor_on_write(struct file *file, - const char __user *buf, size_t count, loff_t *ppos) -{ - ssize_t ret; - char *kbuf; - - kbuf = user_input_str(buf, count, ppos); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); - - /* Remove white space */ - if (sscanf(kbuf, "%s", kbuf) != 1) { - kfree(kbuf); - return -EINVAL; - } - - mutex_lock(&damon_dbgfs_lock); - if (!strncmp(kbuf, "on", count)) { - int i; - - for (i = 0; i < dbgfs_nr_ctxs; i++) { - if (damon_targets_empty(dbgfs_ctxs[i])) { - kfree(kbuf); - mutex_unlock(&damon_dbgfs_lock); - return -EINVAL; - } - } - ret = damon_start(dbgfs_ctxs, dbgfs_nr_ctxs, true); - } else if (!strncmp(kbuf, "off", count)) { - ret = damon_stop(dbgfs_ctxs, dbgfs_nr_ctxs); - } else { - ret = -EINVAL; - } - mutex_unlock(&damon_dbgfs_lock); - - if (!ret) - ret = count; - kfree(kbuf); - return ret; -} - -static int damon_dbgfs_static_file_open(struct inode *inode, struct file *file) -{ - damon_dbgfs_warn_deprecation(); - return nonseekable_open(inode, file); -} - -static const struct file_operations deprecated_fops = { - .read = damon_dbgfs_deprecated_read, -}; - -static const struct file_operations mk_contexts_fops = { - .open = damon_dbgfs_static_file_open, - .write = dbgfs_mk_context_write, -}; - -static const struct file_operations rm_contexts_fops = { - .open = damon_dbgfs_static_file_open, - .write = dbgfs_rm_context_write, -}; - -static const struct file_operations monitor_on_fops = { - .open = damon_dbgfs_static_file_open, - .read = dbgfs_monitor_on_read, - .write = dbgfs_monitor_on_write, -}; - -static int __init __damon_dbgfs_init(void) -{ - struct dentry *dbgfs_root; - const char * const file_names[] = {"mk_contexts", "rm_contexts", - "monitor_on_DEPRECATED", "DEPRECATED"}; - const struct file_operations *fops[] = {&mk_contexts_fops, - &rm_contexts_fops, &monitor_on_fops, &deprecated_fops}; - int i; - - dbgfs_root = debugfs_create_dir("damon", NULL); - - for (i = 0; i < ARRAY_SIZE(file_names); i++) - debugfs_create_file(file_names[i], 0600, dbgfs_root, NULL, - fops[i]); - dbgfs_fill_ctx_dir(dbgfs_root, dbgfs_ctxs[0]); - - dbgfs_dirs = kmalloc(sizeof(dbgfs_root), GFP_KERNEL); - if (!dbgfs_dirs) { - debugfs_remove(dbgfs_root); - return -ENOMEM; - } - dbgfs_dirs[0] = dbgfs_root; - - return 0; -} - -/* - * Functions for the initialization - */ - -static int __init damon_dbgfs_init(void) -{ - int rc = -ENOMEM; - - mutex_lock(&damon_dbgfs_lock); - dbgfs_ctxs = kmalloc(sizeof(*dbgfs_ctxs), GFP_KERNEL); - if (!dbgfs_ctxs) - goto out; - dbgfs_ctxs[0] = dbgfs_new_ctx(); - if (!dbgfs_ctxs[0]) { - kfree(dbgfs_ctxs); - goto out; - } - dbgfs_nr_ctxs = 1; - - rc = __damon_dbgfs_init(); - if (rc) { - kfree(dbgfs_ctxs[0]); - kfree(dbgfs_ctxs); - pr_err("%s: dbgfs init failed\n", __func__); - } - -out: - mutex_unlock(&damon_dbgfs_lock); - return rc; -} - -module_init(damon_dbgfs_init);