From patchwork Wed Jan 1 21:35:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13924275 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 6057BE77194 for ; Wed, 1 Jan 2025 21:35:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A47E6B0083; Wed, 1 Jan 2025 16:35:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 405D96B0085; Wed, 1 Jan 2025 16:35:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 258A06B0088; Wed, 1 Jan 2025 16:35:40 -0500 (EST) 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 066246B0083 for ; Wed, 1 Jan 2025 16:35:40 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B855DAF8B0 for ; Wed, 1 Jan 2025 21:35:39 +0000 (UTC) X-FDA: 82960189536.14.EF70D80 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id CF8E3C000D for ; Wed, 1 Jan 2025 21:34:44 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="NklmO/0g"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735767315; a=rsa-sha256; cv=none; b=3Szcstp55172FAiHHO38w0JpAO7wy7uECjEtzkmFXvP0DS0V5HCKpqdrgO3+yKt1ogNQj0 WJ6Qm9yS4d5yc8XPyI+G2Qo+OsHf3ngin34cbon++4OuvzDN7E7gbkwJcG+Sf/SfXikJT7 kzdvWyx3BFC+QMLIUwZ23GVWVCSnzxw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="NklmO/0g"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735767315; 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=0oNiiBjRa9AQNTwXO9vdR8Jv7AvJiqY3WEFyasQ46bkjAhzkRGl/6vjQoTiJZA7pHVkicH 4yLI8GQlkXAPP65NXEFIB644ADMzBDXpfhNDtewGw1W5DuOFbq9dENcwbAUE7+hcwNM7yv fs/RuCshVEKSmqsgLOlcgd0PNMbLIXw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A4AB05C5FAE; Wed, 1 Jan 2025 21:34:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C8ECC4CECE; Wed, 1 Jan 2025 21:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735767336; bh=CKcT9mDCKGTEuzVadIyy50mQuu1BV9tFkUqyOuuB6ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NklmO/0gJRo1Cu79Wl1uByrVTfWJtU3c/I/J24jtpP36y7ByLl7Dh2Rr5nQ8QwH2U yLo/Kv32o3weOrIvQu9SH92e8nP0t7cDYCUE4Km1KVwkMK4Rp6TAva0DdXfndCsnE6 PFDKJ4dv/23KVMNcA+J+1eBnVD3UkjTrav1597brZfKGvYoEh5vlDuGAuSgBolGcWd JPTdbKiJEbl6uLFKPeyqFPi7NPEBlt5DNxFb5VFQVyf1FEcbKDIqpEzmkINzCKgnMF 8cOWJydNqqT4i1Fbz+4Sr3VNm+gQIzRgya2/M1NqlyneoEwi+4z3rZRvEdOu6nfk+9 Nti96iqmrWHGg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/7] Docs/admin-guide/mm/damon/usage: remove DAMON debugfs interface documentation Date: Wed, 1 Jan 2025 13:35:21 -0800 Message-Id: <20250101213527.74203-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250101213527.74203-1-sj@kernel.org> References: <20250101213527.74203-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CF8E3C000D X-Stat-Signature: qsg9zrocaxsxz1j17o7ncfryxhpjz771 X-HE-Tag: 1735767284-662987 X-HE-Meta: U2FsdGVkX19LbYe3JC+m7FK50IUvyb2mmHplctpdlw6DEryiDzlSqHkV/vBlIzc9kwuf20IYS7bV2HXzBh3yZBhicoABx6qNzUkGJMLMgGfEuVuEncbUuHRNvTO+x2lKmrktlL0AVZWvdkaJ6J8IR75J5XCfojdm1gUCI0qX1fcJqkOw1kxtlNgJWo2SkOfLwZOz6PIpGRxO2tgBK2MU327m7RUwk+E2SIGWf9b8KTKTNQ/MWmCkfFxna+QrBfRBHMnAX6bntMVO4Wz/o5p42pA1VDHeciNNufdR/TpGzreMvjS3gero8UJrsW5JYY3ijT1p0C9oOF9rD62k1w3JAl7PG/TEgkQ6OmcSWZzj+sCx+y0Fq3AN2swNB2Pg1QzBLwo6Ts5EFn5+lEDe8FHVPaLh5jfxhwbbE1r/lM8CSuszILRlfjBvQkp6epyiq+GyVtDY+YA+JrDyY/ocyr1Is1KDxYsMTUm4yIBQY7+ieMlYTekRTCdfozDnbi4ig972cIHYx29tvPkkWpqEHpXfa9prz+NvZ0tGgIrV//2sq6SIn8gcyGxlJJhzG8p1dwE3SiRrktMDm43OJP4kHzKgSVaENM6eZcC9qnO6dBQodmD4UpfujxLhiuB98EeN6paxK9OgMHmcU2YrSi/dildfggrFuJXE0P2/N92uuvfASLeyPN1a7rENFZI13DLY386mmIJ8mSZ96hH7ArBNkKBq0acdCymfaS2PZAz/g6WrZ8dCK58PKJfL0tTq9kMqS5y0WcMi/l2zllvt5APGakpL+Pvcct3sNhQyIkElrFxmpHrpBVojVhjsXqR8p4vnU3KLq/zW0hmMkfzVOPlvSXkUsMUtmtR9klENtX3vkezUXMTB6vcmWraK9Z5iwnbVOTK/MYQVrMEwFsK58hArKrHc34T8M2tNQNp45vQTJJgK3mvSz/YdrxKkVzqwMgu3aeHrzot0NZ3K/NyGq9ucSIR kiCP2646 E1iBV0gpQ6hXWXdoUsAZXo+smoOXa0ivI2MMVo2AoauuLi38SU5iIY/QIjHTEPKiu7ShItlhSomt+myhkfKL1vJ4qT2SRbuhButdNnrFKlVBw8H5cDXZ8C1gohrJg6kxKq7Ys582f/hu61gzSdPT1MFgKGDLkWaNectnjxfw5pw84t2+RtbHtNyp92hvuuJmp2kdY1APR3JTzl5wtitYJAOhPqrcnyPOyFPzaLx0Ge5Ih9W6xn84eDUUiAwjn7Sh/qEZd+qPCior65BamnnCIPvnsWOM3QpaaoHr3 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 Wed Jan 1 21:35:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13924276 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 E593BE7718B for ; Wed, 1 Jan 2025 21:35:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A499B6B0085; Wed, 1 Jan 2025 16:35:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D2616B0088; Wed, 1 Jan 2025 16:35:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 84B0C6B0089; Wed, 1 Jan 2025 16:35:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 6B40F6B0085 for ; Wed, 1 Jan 2025 16:35:40 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 10E42140880 for ; Wed, 1 Jan 2025 21:35:40 +0000 (UTC) X-FDA: 82960188570.22.5D43C70 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf16.hostedemail.com (Postfix) with ESMTP id 084D5180005 for ; Wed, 1 Jan 2025 21:34:47 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UHhA5gxk; spf=pass (imf16.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=1735767304; 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=1DahIBWEzklQXNN0BrxsoSCAC2kTtTN2KH4/9+YnDHWV38Gkj/5U269FzpfLkjGjOYcQzg Xr6esMdtcxdQpzNHY9N0chN5U0y5D+ruCmrABL6hdeNSoKWunT2UatgeVVJTiSIAsXsO3l i9ZFP0rZl7BPmBxLr3ZLzgTWaVl/PBM= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UHhA5gxk; spf=pass (imf16.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735767304; a=rsa-sha256; cv=none; b=FeqROKMc91+UPOlOJ0nhVgpBt9vrXDzjZBDTCs2Gn3Y6lXKdwq5dkGoQWeaAfXPXF3PW90 W1bIgAR+TXuEcEXO2LaZhMb6fZokklcvXcnfo+PSemMks5oNdj0RsnpEwgY4Z6wy3pco7v njkKjbZ5Hlb0aahPgn4KxDvJMbbWkOg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 899E5A40BDE; Wed, 1 Jan 2025 21:33:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85C76C4CEDD; Wed, 1 Jan 2025 21:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735767337; bh=wNqTcFJIxQW0DGiFjvquOYDznG7ET2BviVO3AFzePVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UHhA5gxk1kOay39rsNUMKcL5VNJIKngUbHyRxQ9Q1uNVT9bpE167KT+wbWqY7jeXE Q6VljzQGUcn31tWCvYMnC42Y9dqiQwIkgNpKoMGY5K7XPlboVZia/IAq060pbGC08g m6R6JSOsavS5oJwxWrI/7qjrHltRR5jz79FNGq1CAslofemo5IM0mChUMidBNFescB 11B/VEeCQIdXETPDq2ypVc5GKvRoflw4GhiCqkBZvc7OqHoHhRQe7PJmzqG07GHm0c +h5rA9hIPz/ZjNY6p6lLVSG8kEQLtZZO5p+xkJqFmnqgSOL5/9bxMM9+JyUTQHqQCB tmrn/SSH3DCQQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/7] Docs/mm/damon/design: update for removal of DAMON debugfs interface Date: Wed, 1 Jan 2025 13:35:22 -0800 Message-Id: <20250101213527.74203-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250101213527.74203-1-sj@kernel.org> References: <20250101213527.74203-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Stat-Signature: 8a1wzcb33zndsncfmamrzjx6gyhhjroq X-Rspamd-Queue-Id: 084D5180005 X-Rspam-User: X-HE-Tag: 1735767287-128255 X-HE-Meta: U2FsdGVkX1/Cj0EZGgVhS9j+flZ/w7Q2J0htdYHLV37v++DOt2xQ/A7fOtMeiIADknD8mrh46r8f7L4lMsY8fpOpDD7qVRZdazyouCjKzYMMyA2sWWVCWXigb0QclSjYRR3Q847shoDXW374Jx6mfjT0VBkj+DY8U3UQ1l6V7Plwz8NUFT+4JY7cuAsvNReZzDmMDt5ap50AVvdxjSIEUe9jdVjvN7hIra504vhJTXMa6AsCUXFs+VeNdyVUJsub7KGoVQ7J5/qTZ/sTQMjndvlrMwDno4QvL970lNNPAYL6lMsIWsTOweEmElb0vqk6cUV0W5i0O4am/Gk0hGPUZRiz94auIgNpqPNRNqSkywXoJ9mmgNGPk9cATcNtGzJxClYMSUSAAI0cozyghpoyVJ8DI2+e1wAiwXESw7q7E84LArl1Vkw4bTtnd58SDGhBiRMeZfiOhGQCAYrVHBJi6TaU/nXgufkIcZpT+5OWd8aLE4Xe2EQFzT/9xV1DeIgyyC/Jxo+r5P/NVaO2Hb+fSdToQWBScq98hvw02uEpxlBSrehXSdfC8n8hBtVMuSJ5G/JSwq9bnRZ2hGauVQlow1TBBr+IbwAPb8+on/lWQHxIl7ZJr0dTA2xjmcphpyzRVfCNlKBvZOgYLk8QdzIgJQ8CUHCe67N9VeDg0bSjh/JbNOYHZ7SPFf+Af4wRyTTcl0ukxad7/1NmLBUGQD2Hr9dxgNJXiw8MUPwgXQ+3njthZwWBiDpumI6JbE7FKD/d4NaTke6+HYji3VW7UoC9yiUNtFBV+iPyKT5NIu0u6RyFTfXEq+JWDfcrV/8W7zhpxwQZOfscr21zDPfn+TpLNbb5TTDohZ7uCQg6fivz68Rr8ef868O2sybcpwWXkwug0b9rFX5/w641jHJbyu5mjKpXF0q2j2go2KOUBxmnWqYuIyRLOA+3y3OC7SDZAP2RAhujhoMDmP0Im3reZ3y VG3YmMZF f6ddrXQ4u8+MtUYQ2RT1ZNwsWqYV73PfTZb9bM0sUBwdud5LinkRN1e3+Z658CIUbEcCxQtTn+j1r6JXnRAyPhrGgptu+4g+gpWxuFVq/Rl6+YMBAttpVh9ETDkgw3l9u261YegrC/7Ki/c0kirNGe+NS1oDwpDS6E2Ei1oGcLunXiaOhSG9EpDPkwrzali2UWEH+4a8Fz8H27qOx/WFQAmuhAEQkDTkDOQmQ+JHmpPic06UvyjLyuimBDdNceU4EwQ2yiQcStbWaPWcrVatjqNMgsxDzLIHyHi6FQtOpFkDLbRzdUUXYVApFj2hFAD6HfuxMcMJgtC1c8rcAYeXtDNz6Ww== 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 Wed Jan 1 21:35:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13924277 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 A8B9BE7718B for ; Wed, 1 Jan 2025 21:35:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E1A8B6B0089; Wed, 1 Jan 2025 16:35:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DCAF16B008C; Wed, 1 Jan 2025 16:35:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6DBF6B008A; Wed, 1 Jan 2025 16:35:41 -0500 (EST) 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 A9D9B6B0088 for ; Wed, 1 Jan 2025 16:35:41 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 293161403C8 for ; Wed, 1 Jan 2025 21:35:41 +0000 (UTC) X-FDA: 82960187562.01.B9B4465 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf17.hostedemail.com (Postfix) with ESMTP id D330C40008 for ; Wed, 1 Jan 2025 21:35:01 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XWyWn14f; spf=pass (imf17.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=1735767306; 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=DBXl8vOjITCP3st1NMppe/9Og8SHjXie1UvYVlY0W7tSMVk//1dW0TsL3s/VbzzrqiUMbc c5bCY33sbJrphGb8LQXf/eiO1G2QUoFZp8yzhtVfrdeWFgnAEiCli7c0UeHyFJ69EnrhEv NgNWv8jbwEccINp252sCyYhJ06Iusk8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735767306; a=rsa-sha256; cv=none; b=GlpBRzFdkSAIZT/88VkZCr7d80gUIY09KpUpA7KZAKfjrMI8f911RYIj/bosBobXcT1o9S aSVNnvFeqgPdjWeylSHlnV87iLsXE/NAIufaj7ymHu05sQrnJHmTVrT/FWJzOEbKQWMRPv ESq6TA/ImYjvUlNQ8xh4libVVmPNHlw= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XWyWn14f; spf=pass (imf17.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 98498A40C24; Wed, 1 Jan 2025 21:33:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9142CC4CECE; Wed, 1 Jan 2025 21:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735767338; bh=7oF79jn9lmm7ZWBErpi45JOkdTnxIklx6KgFpgZJtWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XWyWn14fdjnB2w1VbSxqAN4I+d9JuHVyTKwAfWOYcGDNVlIOtmmCs8uqjEjBvbtbg pxQoeK47haNvLqPUq5ZFMFXPxSTlk1eGmONoLnq5O7N+QGcP0arkhwEWpG9lqqJnEw 4tE281qVcmuDnfD4M4FcUdSS1Q1cfDXzpCAMY8kEso7a8mQ4wuPBIrEUv3b5K2l+jY 2a7Mrb1D5ef2Mincx5y1fOJL3vlQ19cWKlwRNDZ67VsQbbZGfCt+lLb23oPC7CdCjp QcYD8/KJWF8PMLnX9k4TaY+HWFDyB+pfS/+CY9mOSRQvrRvrOtb56QblUrbTdHrAg2 aK4RUFsuSbxSg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/7] selftests/damon/config: remove configs for DAMON debugfs interface selftests Date: Wed, 1 Jan 2025 13:35:23 -0800 Message-Id: <20250101213527.74203-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250101213527.74203-1-sj@kernel.org> References: <20250101213527.74203-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: D330C40008 X-Stat-Signature: 3q7teadktezsh6r6hprge8k78aabhohs X-Rspam-User: X-HE-Tag: 1735767301-906644 X-HE-Meta: U2FsdGVkX1+fTdkC7IJ+UooT3ghsmm8mQWxT+JMrDoiFw2986uplMjm9bN3lPQ7Zf0LfoC6t5cb5aVInV/Y6Q4zWAwxMDYMmMNbMp9a/CWJkhOEQAVOkHDfKLcv2OKzyBuDko/CxI68luwBPGM77goBEScv9KMZYaWc11F2mf7S4Y+SDUP0/KOqwZYcnDDq5XEdGS7CFA6Dr5TPETVSUuvaWaYUv+GrBFFidE8xVKhJ4sHwtLAqOOzrEXi5TmgrjH0pja8w88kJsx//p8TBmaKXw2lxxa1jcQXhoG+UyggXwPhWVoomiB45+Q+b4SxU2nicWqrbSBcHnURa9byl8C0vabyIoZ4PGjCYzOogfRaXdO1EOZxrRwSbA3l7Ugc+k8dmOTJctZMO4B/t42yDTYPkF5DONZp8/VlsbEW6OhWspvpcmUMyojfNZKnbWLSQFrCn45cccGN6vGp9h61lWGjZDJLRTdEtZHMrwF7QtKswlyf+krViHoU5wwk8z3vPSPx9f4ImPtHllTDQVR7jvjQpeeq17vuEpYYwwwhgFhs0OBwxUVKGFrBpLRnAu96C/R5NuFIP6385gx56e9fO/hrmC2Ns8gfrylTnEKzfcIXgDHGHBaeKKP9DMuoeBpFN461adYWNsAtf69is70Wfq/dlcIMFBoJweY5MzDXhqX0FuWOGznPq3sKw947KI5upIBnlg1OxVnb+hzR/SrGStULCfDyZ+kxkbGzyvCN1F0M8XDnOUkGGQF+fQ/IcFVvNax9FBwemZzPhKFrQnc2lUkca72XiurhYhXeSizVNlQHVlr37eXg3Mt463PP+MdMErhVIH0t1mdQSu7ChweAgg4SzcA7b0t6Z/G4PjNXIhQuaBTYycL6t+uYYEpcW+bCl2MTKfL3XtAIXGXM66GhzQ2eTdV5lRA3k/31jzqowJ+yu3RUJUqF8eIkZMQqN4cIE7FqnP8+Gl5UH21mROVN/ rrLSorE2 X/0EhygVIkbCSbJLNEDimDVZVKm+1fmKYmt499h6/Kq93LxADo1kHeI9usxAtRGrREgZn7IyuuKqZBCWhvTk20ZgHSEl6sTEzWstcal/uj2i7qTH1IkvvBreVEOvfaM5c7yG0+6zUyP2tYxehmsEuLZ4i/a22LxDhFTl6/0CGlIKYL+hBn0g10j/gqbmuvBGBEYocDChtk5Ku9m4DWEEF9tVHsGziD7O4aT67qZOplvJCl4U= 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 Wed Jan 1 21:35:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13924278 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 46703E7718F for ; Wed, 1 Jan 2025 21:35:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B4FB6B008A; Wed, 1 Jan 2025 16:35:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5683A6B008C; Wed, 1 Jan 2025 16:35:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 345306B0092; Wed, 1 Jan 2025 16:35:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 0EC486B008A for ; Wed, 1 Jan 2025 16:35:43 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A4D8EC07AE for ; Wed, 1 Jan 2025 21:35:42 +0000 (UTC) X-FDA: 82960189032.05.1D5F8CF Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf07.hostedemail.com (Postfix) with ESMTP id CEC9A40002 for ; Wed, 1 Jan 2025 21:34:10 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=J597Jt2v; spf=pass (imf07.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=1735767318; 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=023GfmHL0trjxRNa5vdNzW/Fu3vrhVmo8VC7K5AUJYU=; b=0scA2BI0SsIJz+IXYxHedqglAeUXmIna0tKzFWvh133SQe3XQboHwxXgoqK7JLtfwxnEFC L7T45rSkqz0kwlT8VaCmrPOdO7qN/iI0g7a2GUCv6+HB6/bcMW2gJmKWqdJaFTO+j9myKG 7RfpURwDfIfOurztp3DASV81naQGLmM= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=J597Jt2v; spf=pass (imf07.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735767318; a=rsa-sha256; cv=none; b=TFYLEBircr+xvdljjLleb3hhWzXAngXhdw2WeY1uxyZETHHJjs7avk5DsznTtyu7oYwAII S46OG6pyDznulK+atu56poz4GyarQYHYvTmYYehcdvVIhtNdzjo28eZ08QP0sceoVEw40R xtJPNLB9dfaxCH8kHn9x60mezrC3TF4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 0F861A40B7D; Wed, 1 Jan 2025 21:33:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDDF7C4CECE; Wed, 1 Jan 2025 21:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735767340; bh=zDbU3Gi1unYBD3dBD3wBwvY41bknUi7KCbzpcVIRY3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J597Jt2vSM8n5K5m61xlXQnxTRb7KqrPbgcrFnrIMQCQwKEIeSRwih7Nv9suhYfwH EDgNX8ouJ8N8CU4XljeNr4PPw1SO56qZdNNqs53wjSwg51Pb8RSQuD0k1oGAlWCjNi 9DTPUZODGSwyGSkxBtobwVIF796gapz9EPPFPdhW3FB7XC7uBP1FA8VnKZEimUHdjF Rb53/y8I4DY5ImtmyVGHfh9LlQwKvjWW4McRLF5VekgDOgZO7+yXx7zyCncVq9iPRJ ThKpEhTEVNA+4UryCkihGGQ+Vhyc6zuiE8aIZ0paQm4Q8tNl7wkr5yl3gMosn3XBgv Oz554DwuWBiZg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/7] selftests/damon: remove tests for DAMON debugfs interface Date: Wed, 1 Jan 2025 13:35:24 -0800 Message-Id: <20250101213527.74203-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250101213527.74203-1-sj@kernel.org> References: <20250101213527.74203-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: CEC9A40002 X-Stat-Signature: irp566hh4ipphi95xwt5uubasuh886z1 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1735767250-452775 X-HE-Meta: U2FsdGVkX18wn+oIqDMfVXV93l0n7WuMsyqT4VLqNI6KNyYP1N+GHE3E4xJ8w/Uy3XAUch119CpNYKm5XxQFehBT4pwq3psquN+vrZcwiatf5ZqfXX5og7j1gI2rjPJDHeJ4EWx/Q8v1DQ6xYcD7rqbxHvhvLhbz4mVcHthTIcVmFaa7AUPWq5pQk8/HQxhDiFwX6uvIXmWsfc5GC0UDwq04DfthXPXaCiLtLRX/BvEF1fHGHMFPqrcG27Bl7RLlI4EXxFI2ozOePoJYkXTV/Xai7VSDJiVwiT4TwV0+C1jnn3/JHGi72MqmQFg0nLb5V7uU8fs2PbA5zeKFn2rXFIUyYPjIj6LPHLa6P1QYEoonZ9F8l8ALHdxDS1av4Dvj/zyUxe/WnZ4KcWgYNYCbIvCpXj0FsiJ58NDag68aYeHu8RKA2VIJmfvGpoiNq7l2qiWqSlt0F4Wy1fs8gULGvk8kbRP1yEnHtYprYVrqRKw7CTvaZ7LRcpDOv6r+EYuTfv80Epp/ymovCv7wo0MHinZKnztTX1tbrtWYc7DgXRL7t4KYkKuV8Zn3yxpNamUtFrH0Ik+RAXkiAxP5cta6ZOWguv1a7THeaEZ88f24g9L7JRe6JPM/rrCPV0B+qwlMmITxICYFB+Fo9zmD83X5kQfGdrFY3HIFiqKkuAiaidZP8qCTEE1xWO2Yti4ER+9LTVM7mCXSiiaek5aOliKGfbh7RP2xNaBQi09qTSrAeS3S6EAYwV3dno3RSiDRKpRETjGRXMDrkNQJuizvRKucOAPKMXk6fI2d2vV01AvePtfrkOgQw4LvRZ/Uzvp6IW0jgdi+QswuSB6Wldu+SP/vq21TTr0cGOywXJRUGVj46ZjUH73Fh9w9QbNR3y3pp3SBrQqFbICNoF2fgNWUuwUFmUstkyr4vhwpJhUiAlSt1w2JST1yeoIngf97Ptf65s/m0uJWtMJNC9d84sdilxk Z10nuUdv H9jcoJkFSPX1BKJr6sCK6QloDL0xu4ffDLAqvhiToVNRTUExpiviGtmn5glXt2zeKsM5iI1LhCN31o53O3Qso3OhTufS3QVrqJgVbIHpq9gykc0dQvdetaC3JZnnYiTcZ+tDwypWsKPS4ucgw88GTvDwDJpgAEDkSShI+1mXBk1BSmJXL7G3vXOBt/GgAaLZx8OAwcWpKfEgp27t0QuznFi4EYZqbeNXv9UMKvvnWduje+K8= 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 | 46 ----------- 14 files changed, 1 insertion(+), 387 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 812f656260fb..ecbf07afc6dd 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 _damon_sysfs.py +TEST_FILES = _chk_dependency.sh _damon_sysfs.py # 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 bd6c22d96ead..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" 2> /dev/null -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 53e69a669668..000000000000 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ /dev/null @@ -1,46 +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[256]; - int ret; - - printf("%s %s\n", __func__, file); - if (filedesc < 0) { - fprintf(stderr, "failed opening %s\n", file); - exit(1); - } - - write(filedesc, "", 0xfffffffful); - ret = read(filedesc, buf, 0xfffffffful); - 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 Wed Jan 1 21:35:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13924279 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 E49EDE7718B for ; Wed, 1 Jan 2025 21:35:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14D426B008C; Wed, 1 Jan 2025 16:35:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 085496B0092; Wed, 1 Jan 2025 16:35:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E195F6B0093; Wed, 1 Jan 2025 16:35:43 -0500 (EST) 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 C2C5D6B008C for ; Wed, 1 Jan 2025 16:35:43 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 85C34160394 for ; Wed, 1 Jan 2025 21:35:43 +0000 (UTC) X-FDA: 82960189074.18.DCE9F22 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf17.hostedemail.com (Postfix) with ESMTP id 306EC40008 for ; Wed, 1 Jan 2025 21:35:04 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VpPLu6tk; spf=pass (imf17.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=1735767308; 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=krZ9A9oa+VAjBYbf8ehmdOKRYYl+O5TfRne5yXzudKYpGdy/c+kM9EmGyBOiQwx0YKPEO4 9iz/QoIItQ8tnzo283rNANHfKGaRElD7pinftpM3Z62Ku4PwsHmIxKpguHpUN5IL2jaR4u LoKiwoT39ZPfmRb20ypGu31vTS7fEt0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735767308; a=rsa-sha256; cv=none; b=PPUJqj37azf+on5/6+8/r/8Z/NuTHeC9K6JDtKlQ+vAcUSxr6JutMKmzcixVolrkwC7pIH VcVlhkJsqpfteJ0uU0jAZcTTny4Zoptt+an4W9Lh8Xgf1e/vGrZIB0KENe2R0Bjw9ZEYJo pBMtQjRKQfugi0JhzZitlyMnD+xAah4= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VpPLu6tk; spf=pass (imf17.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 2C1E3A40EF9; Wed, 1 Jan 2025 21:33:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07DCFC4CED1; Wed, 1 Jan 2025 21:35:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735767341; bh=oYXb5ELfdFSBlBTaf0WAv5hcBOQ7eaf8Vl277fIm8X4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VpPLu6tk+FSwnEVbf3Juhf/zurRUyjUgEr24z5hMcl6sUkAjUmufvG4Pt01iUg3u1 n72VdG7VEuU1MQFiNPDDjCbstHcgpW0Yakbn/CMOQGq1gxslVTWK6q8uvS+njZjKfT ZHjttutl+8CMjnYidN/xNhmnZIK1vWjqUK+PR6NlDJjiphN5lTx+VUnCSzyL4aZ8oM cMRdTYqUduw6v9XnK6C06rbyZNoblNMd+w03P2gUlXwS/cJzJWvCbL+iE6o1sDSuD1 O88W9U3tISS2ZmJj3RgBI/M8A5gFWmEZJeCcvPzytqldSodfvO35wDLoIu9lw6s3Hv 4m7t3mKW87W0g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Brendan Higgins , David Gow , Rae Moar , damon@lists.linux.dev, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 5/7] kunit: configs: remove configs for DAMON debugfs interface tests Date: Wed, 1 Jan 2025 13:35:25 -0800 Message-Id: <20250101213527.74203-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250101213527.74203-1-sj@kernel.org> References: <20250101213527.74203-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 306EC40008 X-Stat-Signature: 6pef6fiu7ya9abhzxtnkyowerremcca8 X-Rspam-User: X-HE-Tag: 1735767304-988300 X-HE-Meta: U2FsdGVkX1/CA4lL24X2VoxHIRTLltTt65fj9rUhpMvOlrnsCs0STF0xLBpWKtLYw3KKbTNmiz2Un1/V9hd7oNfihP/dwjkPGUwnjNvsj0NtDA6e9vgc+S+XLb9nSFHQ3QsKTyV/YXZkGO5aEOZKrQHb7Zr+rMKcmrVk7UstrqN36MUUHvYotP17GPVzPXPHk2rS8YL/AeUvKIH68P1df/rXfz8rvVSO0yysQc4JWnZnEOR4iuMwFqn/vL9jJTe+j8Fl+S65nVzC3TSc8+Rdda+nCjt781vnJQhZNcfd1rtIatUYztrZeUkT+ZSoDGTSLPGjuCSqFOQjdQfdGCG/Y41swWPoH5QuTwFfeW+I+5XF3dHt3i+ne/Y4rEzcebDJsBM/xdXO4wfIbI7VBlTTjAtmdUFqszwxtEY3ifEWy78eqMq4YvIXqNNCbIA/JgsC158GiGj5H740U33U69G3WtxgHH/+OxpOjp5XpwngVFNtaELgpOfzkVUiRytzhwMvWoOTfwgSeO5QiVS+LfQXFbP2inSXe5hoXNtrxzaiJFc3pDpSvPNORvDq7LwDpx+lr5hDevNniQ8kXyv6Pj4lw4tneyTlL4bKB9cEGwAX5EeaTtVhr+PRhvIrSFxWTqakk9Q5laulHyWhNKx5Xl6hhwmeHxrwDdhUEV2LXLroWiYUa4apmz5cLOtN/pMylIfcNcrOs4tLsrhw6nX6v7gAX1rziRDXvNPktbn/ismWLK0qZSiu8u7Hr3oOcm7XnQgZfGJlFNH/IjPbHgTLFNbPKO+bhbfFqJAR2XnNyiOzNSTG7CISi15d7Y/6vbKYmmUsVaU9OVMWQZFbQdVUvgvY0CUB5cEU211Y4sjZHNGyPc3ydONHow/OMabcwehW+fPS8Pujj4sGoiE2Qe/CKfM2q+OEgW05hi3+GibRARMYQYBlVBlXVyLdCElP7YqGCNOyUqhL8+zhGafRVwhxvOw zWR0n4ou JrjXt96kIzJAamLgta9/8g+tS1ZE4jnSbzWBtIksuMizjetv0CrRqnkLlVc7nngZMRQapDylSJd7ccdG7u3FpYkFFYDEhFpO59BpZz0KcwUY0BXIW8s7YgNhUtWwL1hiZ+lyTCrpSCyMEQJNL/SClRvDY06rnLVTMJQfjfuBJsbXoHWRG+nwhQTOnDl9fXYYBu5XywtAZg2L4CEn238fHckzYFhIIyEEIyDe912QPCiXxq14= 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 Wed Jan 1 21:35:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13924280 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 6EF39E7718B for ; Wed, 1 Jan 2025 21:35:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A26226B0093; Wed, 1 Jan 2025 16:35:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9852C6B0095; Wed, 1 Jan 2025 16:35:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 826E46B0096; Wed, 1 Jan 2025 16:35:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5EFA66B0093 for ; Wed, 1 Jan 2025 16:35:45 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2499FA08FB for ; Wed, 1 Jan 2025 21:35:45 +0000 (UTC) X-FDA: 82960189788.29.407A08A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id 14A03180007 for ; Wed, 1 Jan 2025 21:34:52 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=PfmiU+x5; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735767321; 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=pgUr5w7PHXmnIcfFMMd7kSnXq0DErC7wtWQ0arR4oa0=; b=3M97cbYxPslVly5BGoYn7ODaJYJ15xt7l1+7pwjQd3wtS7IW91fBlXz3QUJXHgkF5Je75Z jgpZWu3mSSvl3bChxQLjd9RLBHLGBCdM+xNOSAdUizpWyKMOjKE/SkjMevuN2FWLD8TyC2 JuQWMewBvkq70S/n15gHggNxpleccVo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735767321; a=rsa-sha256; cv=none; b=bskCEoDWINVBsHj1RiYR6772wpbIhv/ZI8HLyRVLqq4zuxZHTNH6omxok8q49t9HrumuYx z+NVrRm72xXs6CG98/slxreePTj7E3fAg9vIzxUwh1aax7f+1bWN4p9RHh+hIXKfaYJ/u4 hBbtR5NtE+InqFKbSNtDGhrTDi1Mmts= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=PfmiU+x5; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4B2D65C5FB2; Wed, 1 Jan 2025 21:35:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AAC8C4CECE; Wed, 1 Jan 2025 21:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735767342; bh=6FG97a2QCkNzbJZKIVGLLC/WiWRcYRT8nrNZYRnHJGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PfmiU+x53jG0P2hkwOLeJFVcJzHVBEXfJOtZ7ZHtL0QGphXvJ7hChiXdUtQEI6gKh iGHSSkCjlQ2XYrrQbxhovBS80RTyAWV1U2mwMN7jUs6Ikl8J/rMMPyKNF3BQzdT6t6 7jrNIYWMHc0ENW3QRCzVLdg5JZg5nA7QPhk4StNU91ZfJeV04T+0iiEFzw4t2ShShc FgddVLy7XaT+djzpLJIxK8dOMWjy5Hou6jJmxndNwgsnPLx0NObN7cgal64/nYEQtU uMknyqLl8NuP3oLbd+X33NiUodQ09gmDPVe9daQQHgVO3EIh4f3q1FHM0zmWMq5Dqk NvgNaj2KwnTIg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Brendan Higgins , David Gow , damon@lists.linux.dev, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 6/7] mm/damon: remove DAMON debugfs interface kunit tests Date: Wed, 1 Jan 2025 13:35:26 -0800 Message-Id: <20250101213527.74203-7-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250101213527.74203-1-sj@kernel.org> References: <20250101213527.74203-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: zz8s1zr64qttcxybrjo5mwkr55ybtamh X-Rspamd-Queue-Id: 14A03180007 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1735767292-525246 X-HE-Meta: U2FsdGVkX183oMNVW8gRvKo8kyoEEkVUfG2ysny5XKYXGwPLu38S19SY3VETEfe0WfXVOm+cntuQfdWG/hsCrfUir7G3YIL2lkKubT8seqML5c+UG3QjXw+eU6dEFLyK/v5zC0oEBhc/v+qBYRjUKgIgYQl6VGsyfIzVVygrdolcF4MBrcTlLI3pf2BMeY9yEa5KLw5bnRQZ6UKxtcbiMmRpacbGebYEVS11DGVC0jwmzPl2lwHm/QXUqNSBf8gLOEzJ8UhVXBjBpN4d8ZAiQMrmviQwKyqNPnp5znxyyT+a+/rEkHYMDuYSn9t2uvQY7bWh1aZb5zwQ/BmpqvhrrlIh2L1kevBtL5XD0ioc+jEO74NO6K38HzpaA6/Dmx0lnz3neJHBBGpjX5kRU5YXQDywfNUDLXcEGnrKyesVQ6jzO9C9NVHmawdj+D5RTl5zrD7qLtVKh3Qg11uRWBbBdUm5NTsu4l2raNes2DsKfziUqTb5cPFc5L6IZR7YVE6CfYyYMVa2iiyRd0FyoGuX2daQ8gRiQYt6LZ2WrM9pNtRO5nmOpanUnLTGkthfetGbAteRpvtqACpu4YMwQUsgH+3EnualMlArfGUdBNCeuXnkMQUVUwCc0aA/Ld9Zo8EGL5byZk4vRavNficiQPOXU2cQLS6AQaMpgnEbcS40n/xyMOwFIABniYx0na/iQ352T5EWX0vT+tE1A9j+uxJnKaxQQ56XWlpeQpzLSBwxasIpifPUrjheCW8Q4UJ0F9rOQTR7vZ6rLnkWQLdSboMPzc1u28sO/21SgebcIo8anm55/KOp71k0gffEltEWiYjqp9IlzrcBP63Fr2xvmqqcDLjV7XkIF4hQRZeb6cevocMY1zACLYJUrNQA4kLco+njF3pSAZ2IOW9piYd0hetbxbPfEwEafyUuSqzYQvJvVl3gdAx/80+6q+R9+k0ALtw/okpQ0WUQQXJ/9rze4Jf GEribyys 3w/abi+VROMAdb6Jv2YmP6zPYGoj/zfeT55tuZfRiMRJXVUZUzr4ogxX01v+riQAN+P4ZjAI24Qei5XXrjHgzABmD5z+2LPv70zympNcPxi6xmUp/HHR5SG7KtyzlInecWF29h+51u5x7PzGifYanCbcHV0ulLGa9DTaDQASZ+vAWD/PfpX0Q+yVoSQe54uGL0NZcaMkkIlF89I6RTcdqOPWBCLr2Ym/Ww9uJEjtxnY7Jvgo= 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 d0357f3e9372..db0d92624e8b 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 087e53f641a8..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_DBGFS_TEST_H */ - -#endif /* CONFIG_DAMON_KUNIT_TEST */ From patchwork Wed Jan 1 21:35:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13924281 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 BC9D6E77194 for ; Wed, 1 Jan 2025 21:35:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0FCB56B0095; Wed, 1 Jan 2025 16:35:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F298C6B0096; Wed, 1 Jan 2025 16:35:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CDF7E6B0098; Wed, 1 Jan 2025 16:35:46 -0500 (EST) 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 AA61A6B0095 for ; Wed, 1 Jan 2025 16:35:46 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 577A31A02F4 for ; Wed, 1 Jan 2025 21:35:46 +0000 (UTC) X-FDA: 82960188738.10.2CD1402 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf20.hostedemail.com (Postfix) with ESMTP id 6C5EB1C0005 for ; Wed, 1 Jan 2025 21:34:53 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DasVEjkK; spf=pass (imf20.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=1735767311; 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=XQgzt4XvRDDvJdNL0xcCZK0XL8QM4NX7Fh0tZpl6MJE=; b=VkewXIncsrlhQCfkCXCj8VkTiD96qYuEjpNUBROANhdK9gtVlJyMTPFbWPdj1q2xlWS4jY GkMbg2FyBV8fiyO+arZwiTEqnQP0gvNXrz45WHKp3E+ntjwpTA1O4G0uiEfHvgFlj5+Wz+ sHSfpcmXYpXtcludoTOYPunsliCisAw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735767311; a=rsa-sha256; cv=none; b=XnhgFSfz+dzptgwwLpSOZzYh60OQJXy09J8FvhyB6NooTFGf1LLTNZh+7J8oGb+PyoGWLE 3LnhiFwrfjUNZ+V+SJrOGIWummfE/x0K/j36AdyikPzHfKt0zobaMCp9blkMyxs+c6Z4O0 BLGXsPkEMjg6KpIhkKtHb8c+nWOfYRM= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DasVEjkK; spf=pass (imf20.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 55D135C5FB7; Wed, 1 Jan 2025 21:35:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 349EDC4CEDC; Wed, 1 Jan 2025 21:35:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735767343; bh=0aYMH1LZZ/q5g0T5L+9SmaDcItdCimd1dZI+nrViQMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DasVEjkKWmhBu2ROo1JTTS1VLMcvmKaHhSGjKoOtZonyewTvCH7SUuLZ7fmixLOQF 52xVQIxuEjj/ee1potDf6zSci1VR4NFyXVRHEA7dGGmteaErd2Avr5WF7FtbzPwtkm z9/fUCPL2DhrioqOJdlxKMiR3/RV7gmpgJ8WhZ4NafgKCSYh2Jq8QnnhWgz4R+jJJp RnTLz5TdVvvitb48LXZ20CefW2T8U+XtRRTvxHkTiaDG9GsBhkZ0iwBh9khJPHhEph ZlYyMd9dmgfdhRoyWhISmOSP1I+qnZiy2sUgc+nivbrTkMMRcYwZb7ofm/2ThSampd yi/W8J3VTMeUA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 7/7] mm/damon: remove DAMON debugfs interface Date: Wed, 1 Jan 2025 13:35:27 -0800 Message-Id: <20250101213527.74203-8-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250101213527.74203-1-sj@kernel.org> References: <20250101213527.74203-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 6C5EB1C0005 X-Stat-Signature: p8x7at8bwayqoforrc5sio1p53ii7w1q X-Rspam-User: X-HE-Tag: 1735767293-468062 X-HE-Meta: U2FsdGVkX1+Dyd78YGyfV/XBT4XfWkUmNTVHWuf3BNiFxdzm6BkEuV50h2aTzh0jSF4UbK2y6qlUBv9xVNFyddwhhXS8z2WQKaVYdIs+IXH7JlextAEnL6H8Hl9VMWca88izef42AIBucD9hWw5k+uxbczCd7ErCh5jovUlFMjwVgLrmBmRAGRuDvDYahGgxQpIHAahdPA2flW/k9wyCFo20DySPovPcuUwJVoLpfxR1CuF+PTs0GnKsjkeMHZXSfLMSfmzKJytVQgGSRW38jrZOU5GK1IYIt8JL9h+ovdf/HWVPYxC8hnWhSlnFlGtYmN0id6ydSUKQVMY1qxzhdYK8GfTFEf2PrfPuFEV0BjjK/yWdFDhKLp814jrFBjtOrw3H/lWRlkmAzXT1CPtmkzRYgwoJczxuBhEOZnzJlF7yfNYZ/ZtiUpwAwEQlqtc7D27matLmPCSpK+A796KR0y22vU8B63iFbiwh3d7bNfrqt+m0YcfE7/x0kD3m+lbalOKrS3CgE9ChysQEG3yAkv0KYVWor8rkl2hxGrA3BSixCF5pRngt1oeXsZzUvRqnB5iIGywS09N7a21+ftqkVjIvcJfUtcKCLOzeZZ92a8puMcsm17X0YZZ9P1rHSGTBC5qL7GotpLMd5Wd+LFhMeKVAE+L8DDEi/7+SQq/6QTZsQLJls7jT3xQ9XXdQUk+EBiXuPTm8vGF5UJEEnYNIFAoRUGujk05VnRVw72kI8yVc9g1H31Fhc7m9ZIAzPePJUg2GLYKZpDSCjAfvurs0gXJUS6mY7meFbvWNaLCiFu6lmrvFU2xoyFLDfurabNnrj4JaasFlYqUF0U0+aWwqumil6/OchhZbu90Z7gaIMvXyH/vKOaLhnUz+f8551zapiHl8gmSCA2HQawCcAblLFWvVhbjdbGECZ3l2FPVx1+gu1qY1vXVrrUKnj1JM5pwkeLU4SiT1zOwrddkU9LI OuGJj2Ay HPGgln7E6m57zj4HvsFRxE53oy7ieFIg+GFm2AjmnL7p/6mhdiYrhF3BYyILX8izwhxFhi11IqZ7T749VOQVjL3UHK3AKAIr5FF/Gn62klbchyTDSKn1RkFCLnYOUhgocgf8zIAcFLoF4L/x3n5e2PTcFOJGqgpWsLReqNOLpuNdPIU9Kz0K0lmlR0J2GpmMmpw4eltJwQwD6xUjbYlPsUL3ZKWYJjRybyNJAjCUVnn8yGxLGEYCJRo2v4LjZGXmMVEyRH9JPdd8rzeTrP3Lii5bo+vMyzvAjY5TB 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 db0d92624e8b..c213cf8b5638 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);