From patchwork Mon Jan 6 19:33:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927782 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 B09DBE77199 for ; Mon, 6 Jan 2025 19:34:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 138E66B0096; Mon, 6 Jan 2025 14:34:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F40D6B0099; Mon, 6 Jan 2025 14:34:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECC516B009E; Mon, 6 Jan 2025 14:34:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D19B66B0096 for ; Mon, 6 Jan 2025 14:34:11 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 644BF41A98 for ; Mon, 6 Jan 2025 19:34:11 +0000 (UTC) X-FDA: 82978027902.16.B545658 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf02.hostedemail.com (Postfix) with ESMTP id CADE180012 for ; Mon, 6 Jan 2025 19:34:09 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=A8l0h8S4; spf=pass (imf02.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=1736192049; 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=jBSofeIvXALKj2Xzu8l3oYz6+1drxGWC3iDO5Daf3OQ=; b=17Q4rSe4mhQmrgLr4GBgzqqGuL1v1OHxFXoy7cVIh7iExuRzXOMU8t6fkvaYXZ8H6YvmFz 8AQzngCj2JhUXwkN0m6P0f7guiIj+8HTUgUNKsET+8Kmcb8tDdq9yyL798cPYFynoNwsqk 5OvEHDT17YXM9zsdgTVLxUgCDF2TuBo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=A8l0h8S4; spf=pass (imf02.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=1736192049; a=rsa-sha256; cv=none; b=lQB08M9kYfDDRBCe4CPvUVcqxkaMfpHpy+ktSj4etWGweYqECdVmp2vf1ufRFDWXZWjr+J adCxGScPAFT2tHd56sY5+Q8WLLq7CBdjTBSLHWmo8//8g1+A3MUwpYyWZbgDDqK5GHXJWr 1OeH7hCj2AC6r8OasbUglWKlbu4Wuj8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 5A722A41D80; Mon, 6 Jan 2025 19:32:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E036C4CED2; Mon, 6 Jan 2025 19:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192048; bh=qj6QWyOD/vM16R3ECxClV3J3o7l3msnzxK4/LkXjXQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A8l0h8S4TeRjSGATIMkb1PfMopf+UW8RezfO2VkwcGRrc/e2pYzf78MvnitsaAhYr GA5J8txVBRUq3W+q4d7+bbJ1zpqvbJQ2s9pppFrwjsY3+pmo1PnJ0ltgaFcHk8UqL0 k+piP6rOQD3MyyDNKGJFQz62kQaKFzCEyq0AADV/e9IYtVhhlWmZtaxywVtrZfb4NL iQuYo5B1H6PFEwJhUq/yI8EtL/Li9SxyuwRp5U2Q6tpStImOr3Gl1S3mjA24V0c/Gv yQfcZtL+f9y7LHS0W5aMdrDB1X6hlBqNWbwhbHpgx4X2xEEeL/JOEOkQsS4CAz/Dy8 T8IvacplUVvVw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 01/16] mm/damon: clarify trying vs applying on damos_stat kernel-doc comment Date: Mon, 6 Jan 2025 11:33:46 -0800 Message-Id: <20250106193401.109161-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: CADE180012 X-Stat-Signature: 843mw7e6bw9b75k5nzi7g49rhbkkkgt6 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736192049-243861 X-HE-Meta: U2FsdGVkX1/Y2GvnikwAJxWtvEl+DordxGKt97QkhVze3Plqlk6rZctWvBDGrhSBlwGjJRQQ8C6AmAKFVTNizeYs1KJREVsRhmr1KKoNmf714yDkD2ySP7iJMKDmzT5A3efu3lM/GsG9nPtqBzpJapI9AbhJ5DTdmecjZS3w26n8KWc94ZQXOBV8FksuP1vz+1oSRGr7jzc1MTphQVhaJxOFYC14eKRUU2sseS79aGowDV78GbPVcxbYaCZmg6/YgIUNECDOSLeYz72YFOc/IXrHce0LyfHcyQaezqhdWXy/dRqi6Iq7B9cC2dwAsgMwf5ucIWmM/Dra350FMa8WZlGGhwRZMA5dq0lRXN3x/qt8VtlsQGRaXd+ShOO7quoutICcaeVS1IAhU9a7m77/hAr9ove1v7uOjSF068r9YZBUL2YNBeKJWZhhVM8Z/v1EiP/2aQwulZUNO20m8USExp0lGW1Mop7ffWGvlaY61wrTgIr8RhcL9u9H6szYrkLDcr9elkzn/j416tZ6Z3iLdjiRowmYp6F4UYwXV6rlad0bUAwTmh6KmoZYCO0FY0BEttmjxT8HpCzxg3LT3WI1CxvCSgtuZGLbDCHd9P4cPccHBRLCJM/NN0flSibGOmug0G1aPS/4ojHBGhLohHi+MgxWPaGOXwEtGmIzvwDjqo3SBE6J1Ypmhk4emd63F4r+IEliMDMms1G+ZEomD5rGAggsppdcUnSgPhv+bDlUngLTmoRA11t4U8WwbmBTiD8q6BgLHJ3U/ou1gWgYb4rrBqhNqOgS6nbYPYvBWok2Qq+44yXFTehvFn5P2Tfu1VBlzOZoH+yIUXvqE/QQNjXXL/HIRsLqXUVUIJivwQ6sFgVQU6520jxNSimLlaEm6IMqCPHvmmJMIeQaJo+QZZsFA6tfkkI0LkOcwt1dSun04k72VTKpgZQF1YU8lycVaeUWIK4qGNaGGc4kxFsiD3h iIQdku7Z VYfMWTTHjscJx+RpIWs4AVDiSTrsmNKP3gea8LIspi3lF3S90U/oz1FbSPOtDBxSct4R5pbEVDvfM9FPXohwnu56BcsMHEGkaOrF0PLN8wfmQVXpOe93dj59pONfcNUaX89fLwSgCYfDjQEf/bJpMSEyKiD3ItGu5Bi6+xPcUYjNteFPajEZQi3NGrq6EWRjybxTMwAx/KcKLZ6IZ72BcEcOx1rB7MUYS08E7mJNwZsmdeGUsydv2QN05Zb7NF8KIMOF3ma5GeJtZnAnu3yw7oABHIA== 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: DAMOS stat kernel-doc documentation is using terms that bit ambiguous. Without reading the code, understanding it correctly is not that easy. Add the clarification on the kernel-doc comment. Signed-off-by: SeongJae Park --- include/linux/damon.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index 2889de3526c3..b85eae388f5b 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -287,6 +287,23 @@ struct damos_watermarks { * @nr_applied: Total number of regions that the scheme is applied. * @sz_applied: Total size of regions that the scheme is applied. * @qt_exceeds: Total number of times the quota of the scheme has exceeded. + * + * "Tried an action to a region" in this context means the DAMOS core logic + * determined the region as eligible to apply the action. The access pattern + * (&struct damos_access_pattern), quotas (&struct damos_quota), watermarks + * (&struct damos_watermarks) and filters (&struct damos_filter) that handled + * on core logic can affect this. The core logic asks the operation set + * (&struct damon_operations) to apply the action to the region. + * + * "Applied an action to a region" in this context means the operation set + * (&struct damon_operations) successfully applied the action to the region, at + * least to a part of the region. The filters (&struct damos_filter) that + * handled on operation set layer and type of the action and pages of the + * region can affect this. For example, if a filter is set to exclude + * anonymous pages and the region has only anonymous pages, the region will be + * failed at applying the action. If the action is &DAMOS_PAGEOUT and all + * pages of the region are already paged out, the region will be failed at + * applying the action. */ struct damos_stat { unsigned long nr_tried; From patchwork Mon Jan 6 19:33:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927783 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 52601E77198 for ; Mon, 6 Jan 2025 19:34:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E55E6B009E; Mon, 6 Jan 2025 14:34:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 297CC6B009F; Mon, 6 Jan 2025 14:34:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1877D6B00A0; Mon, 6 Jan 2025 14:34:13 -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 E45816B009E for ; Mon, 6 Jan 2025 14:34:12 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 70C7514028A for ; Mon, 6 Jan 2025 19:34:12 +0000 (UTC) X-FDA: 82978027944.29.CB7BA50 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf28.hostedemail.com (Postfix) with ESMTP id CE81DC000F for ; Mon, 6 Jan 2025 19:34:10 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ed4MFfHg; spf=pass (imf28.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=1736192050; 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=Gg2hAXlTiuQ78S/va6LYuB/4+qeIelkZAhVlAGD0kFc=; b=eUVwFfmjoiCf+N4s5vmkfLjQqlx8Bt1gptJnySTLlbEmNtZd/ZpjCGjgRkGYRfCmoYaMpF nCBmICntv6N/VHIuEFYwgcRfOpa2rIHkN6a2wawhg5VnBp2E5dcxu8UHRg1NvtrS/2T9Ky nIus8BdaT/L6gf2UXQDHxMcQSb2EMJA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192050; a=rsa-sha256; cv=none; b=tRnfiqX0VmvbVI1GymhNqDhHPxqBLf4gjU3BfHWVc7SH61s+Csxlw3cPClD6xtDL8qAa6o r7OjYtWtZDFi6kONPqzfpNfwFvI5VgcBmnn6ocSoO2Dx1SwRohx42gZGejqvk1BXhDKBD4 fGmzXKWRamso1fClAE5U4IkgOGHGs9w= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ed4MFfHg; spf=pass (imf28.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 5523EA41D9E; Mon, 6 Jan 2025 19:32:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFD25C4CED6; Mon, 6 Jan 2025 19:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192050; bh=DyNPqMVv1qWkL7drvuA1I9SW5htKBzMRMHtsO46tXdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ed4MFfHgRDl2+cLT291VwyY3qps68Bad9io/5jDB13HhKMjE0QfVufeCR39v5mjLG pIqzuFBY463MZ1efvzIt4UaUVWBLZAUv05VMd77Egy7FrOvQrVl8ua5lPKZ9pwTINH DBkb6MDIiXD48pH7fGXjoUnt7ljp2L+GdFzB7OedYBHAYQLduZNvjXf9zOwhpNlhZl ayF34YfrT+j2ZhwRNy/wC7Vlc8rfjXS0w4duRLoly1kuowElUXoJ59dBWTrpCH53pS DxUvBVtrcm34LWbWvertf3KlnYIRBvvB38/hnxFvAh/7xF2qkLpOXANMzuSldUNHMM iSefRCqGx86Bw== 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 02/16] Docs/mm/damon/design: add 'statistics' section Date: Mon, 6 Jan 2025 11:33:47 -0800 Message-Id: <20250106193401.109161-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: CE81DC000F X-Stat-Signature: jzm3m35cfi7skq7ddye3yijeq4d54ayr X-Rspam-User: X-HE-Tag: 1736192050-420962 X-HE-Meta: U2FsdGVkX1/HK+AR9OyUaBvc+h5J5Oq/EQUpgkWT3TO/Q3NxA/5+nVbGT5JiY9+UmNL0jwz3V67W3a7iJsQJdJsDMf25vDa+a+DeAwmyutztIyaqi3oYdohDW8p6+0clW/WunyMdgSWEpc9+uFbPy/ITm3FhfMPRN39tO/GCFf8gP9K6zbz/kOWHjqh44s5bkbIcXtYT82StsRdJYaBRZlGC1ZyceflygjInYBJlnRnxo4Pycnh1WqX1USaLIqXqQ67FA+CD/26SeA6ug9Lx8Zn6J7VhKbLQPndTrsvEfjnRt8c5SBr94qlZpEdkcQielF/7UF0/7fzpCK0MZ8x+9yAEZObiUzIhSBUan6xcL+QHc985R/RdUO9NYI1B//EQvCRwqYCgDzy0bFkYpKVw4VwC7ihMthJ43Nq96E12E7xqWpYIgGNb9VmTs5m/bYuIwyBZkNOEegqZYRSkXMEKrKu0ZvVL9HjF9aa0TQUb+mMPhr48U8e+63UY1h0PCNnop7K1jJtfvmq+sseLWGpio381nbnUzofAjZDCox8nXv6ZtyGNq1efaA7TPfccPLJdRcPVhBE7F4gVyJoKc1WiCZsat6yGQBqkfv0uvTNX1RKQaTjSc/YMNIeaIlCr5CFBBKPsNAulGbGxGoexSXnHGXhiWHNgWX872YYDuiVEBGm6Pc6c/tdSgyuP+F4yrz80kBOO3S3oQsW3saXADuEEhIhC6SlZGsPcTfipFC1Wf4ihkmxwrQcpakxNaIE28QzhSyE1QdYdVXmq84R7KB4u4zov3scxH1wauK9BVeURldwigcNgY35oaMEWaf793LH4PsimVCed48QNqky8JIZaNiFw2JY3JWq5KS8/wNnQUS9sS60E9WX27IpoYU2tEP4HdY6oHq7NwlUK4n6jbb8sF3HbFICFJmKYHgrfIdhq0GbUR/NqSnrId/PzWL9sLKdMWWd+JRKyZQ6YHEsyUqi 2SUmKadM 0GPu6dfSofC38AZTMEfsqdz7QCiGoUVd4VBRVfLGmuX54GPMfRxVmTYtyFTYF6ty+djJAMcDVu1QfbMG/kcfsw6sgxey/gvyWMxkA8dG8rqf7b6cq2FievUrg/QU/aIGRZZ4sAw1YQ2mOJlOvuixyOPLhxaf1J8iBsohK5T21ShIkykoCDyv6HZDd8ZNTg4kaqbgrx+jIUooP0rJZvMPhWeSVILIvOlaJdmw6DN/3AzJxQFE= 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: DAMOS stats are important feature for tuning of DAMOS-based access-aware system operation, and efficient access pattern monitoring. But not well documented on the design document. Add a section on the document. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 5385ea04c2fd..aa2e4694ee14 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -539,6 +539,44 @@ To know how user-space can set the watermarks via :ref:`DAMON sysfs interface `, refer to :ref:`filters ` part of the documentation. +Statistics +~~~~~~~~~~ + +The statistics of DAMOS behaviors that designed to help monitoring, tuning and +debugging of DAMOS. + +DAMOS accounts below statistics for each scheme, from the beginning of the +scheme's execution. + +- ``nr_tried``: Total number of regions that the scheme is tried to be applied. +- ``sz_trtied``: Total size of regions that the scheme is tried to be applied. +- ``nr_applied``: Total number of regions that the scheme is applied. +- ``sz_applied``: Total size of regions that the scheme is applied. +- ``qt_exceeds``: Total number of times the quota of the scheme has exceeded. + +"A scheme is tried to be applied to a region" means DAMOS core logic determined +the region is eligible to apply the scheme's :ref:`action +`. The :ref:`access pattern +`, :ref:`quotas +`, :ref:`watermarks +`, and :ref:`filters +` that handled on core logic could affect this. +The core logic will only ask the underlying :ref:`operation set +` to do apply the action to the region, so whether the +action is really applied or not is unclear. That's why it is called "tried". + +"A scheme is applied to a region" means the :ref:`operation set +` has applied the action to at least a part of the +region. The :ref:`filters ` that handled by the +operation set, and the types of the :ref:`action ` +and the pages of the region can affect this. For example, if a filter is set +to exclude anonymous pages and the region has only anonymous pages, or if the +action is ``pageout`` while all pages of the region are unreclaimable, applying +the action to the region will fail. + +To know how user-space can read the stats via :ref:`DAMON sysfs interface +`, refer to :ref:s`stats ` part of the +documentation. Regions Walking ~~~~~~~~~~~~~~~ From patchwork Mon Jan 6 19:33:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927784 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 D12E6E77198 for ; Mon, 6 Jan 2025 19:34:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 35B326B009F; Mon, 6 Jan 2025 14:34:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E3796B00A0; Mon, 6 Jan 2025 14:34:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 164606B00A1; Mon, 6 Jan 2025 14:34:14 -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 E1ADD6B009F for ; Mon, 6 Jan 2025 14:34:13 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 96598A0215 for ; Mon, 6 Jan 2025 19:34:13 +0000 (UTC) X-FDA: 82978027986.11.2A5166B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 080794000F for ; Mon, 6 Jan 2025 19:34:11 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hzX2HhDR; spf=pass (imf27.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=1736192052; 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=aNCasyy/zneJBDyynNUhI/AR7CR07gxi+f6WqfqE1/w=; b=7Aahtect8g4qKrb7vs5N6aCjzxeLyjp/ycj5/9H6X28IHQKQ35R4w5uRVaftLVgrtM8YXE 6T4IPfQbXfzvAHU+MiyQr5UCVOAHd/ZGuNTWf2ULOSmetxZYJvw4z/PfsjPjDTdS+OuwVV +hzv22Vv5OR1XeC8dgLe2bddfPBDTYM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hzX2HhDR; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192052; a=rsa-sha256; cv=none; b=3u1zNoEcJRfzHMIejJEqL0xKuFYv7SztpUaq+boswv1KHRsa7bas8N+eXhyjvzztD4HCPX bbq02WvJjWrHlGWVX6fPivwKUGnWoWse3GRN3z74i7JSY1ZkGlWewT9r/Gpp3i5wYac5uY Xby4Y3TVsgbk+i3Fc7TqgEx2WEc8h/c= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2863D5C4A97; Mon, 6 Jan 2025 19:33:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA771C4CED6; Mon, 6 Jan 2025 19:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192051; bh=Xy/cUyoqUpo6pu4RY3ebUwHZ83NPf59O+4AQ8ljJSu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzX2HhDRRLJIqeA8n/fcBJWT8mLbmy7WeW8j7w+YR7dziXB43hzn8Tl5T9vie6eqD ApH3/H6fSmd0uMkiDSsZ9expdHg1DnXnEH0P09jE39nvIfEu/6Nku7XWF8dyHPgTRb 7XwwUV5kHNzmOA870z437dW8Rz3/NkosK5IPzMFYHB9A57gFkcia8z6aqVe6J7QT1D sRwQfVHdS+j6Ov9Da5PLbtO3IE73FzG87dy90bWrP1IwIu6AVlzfJD6feaZ3G01YrP 0Y8gorNksOqrG65TW4XhVftjjYOSOW5q4WptJ1ldr4ki/soXf4O6+G/EdFq+Enrsbg 4kXBHSgT1usZQ== 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 03/16] Docs/admin-guide/mm/damon/usage: link damos stat design doc Date: Mon, 6 Jan 2025 11:33:48 -0800 Message-Id: <20250106193401.109161-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Stat-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gT6hEsFoeUzNBtNADXWJa9ag+i18KdRXzmOuFtYVnZByWvqnqYU0qfqMCxSmHV0saZINJpk76svRsNapLGVafJUKAlVip8iCV6/k7FxzxE6+dh3qQ+/MC3IoNCY2hUDKgYrG7T+KU/C09YVpM2Mix1OzfQnGRCP0fi4CN8ApmgVHnpsYpdT8zc3CheZ5F5ozwb8EA02MaFnsQGsJlNRhkOUfnZfAD47KYIRoZ6ppH9Kbp7nwaG4sXukqRmBuU3E+TdE4go= 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: DAMON sysfs usage document focuses on usage, rather than the detail of the stat metric itself. Add a link to the design document on DAMOS stat usage section. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 3 ++- Documentation/mm/damon/design.rst | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index c685d87ea078..2e835c9bcfdf 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -451,7 +451,8 @@ schemes//stats/ DAMON 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. +be used for online analysis or tuning of the schemes. Refer to :ref:`design +doc ` for more details about the stats. The statistics can be retrieved by reading the files under ``stats`` directory (``nr_tried``, ``sz_tried``, ``nr_applied``, ``sz_applied``, and diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index aa2e4694ee14..158d0a4e1d7f 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -539,6 +539,8 @@ To know how user-space can set the watermarks via :ref:`DAMON sysfs interface `, refer to :ref:`filters ` part of the documentation. +.. _damon_design_damos_stat: + Statistics ~~~~~~~~~~ From patchwork Mon Jan 6 19:33:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927785 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 88466E77198 for ; Mon, 6 Jan 2025 19:34:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD94B6B00A1; Mon, 6 Jan 2025 14:34:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9EA5B6B00A2; Mon, 6 Jan 2025 14:34:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EF046B00A3; Mon, 6 Jan 2025 14:34:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 52FE76B00A1 for ; Mon, 6 Jan 2025 14:34:15 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 03D53140282 for ; Mon, 6 Jan 2025 19:34:14 +0000 (UTC) X-FDA: 82978028070.08.6ABDA8F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id 4A8962000A for ; Mon, 6 Jan 2025 19:34:13 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=soICbBBh; spf=pass (imf13.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=1736192053; 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=5E6LVu4rcKmXTf+SXGmOSyZmKEjwfbomAy4iNKf5CMs=; b=XQSQKgOlHajY3XIO3/hCW1Pgf+Bmu1iZ/Kk9XWG/71cIHShMYfSJ5+4izCbrFYNLrzOKxt GE0f0BFMUivajf4EI7GYeTjlAtvmOGS8BpwEiU9neoiNu2KhUMz92N0Kxhw9hhkw6RbaZ5 2wDcr/J0zsvnDq7/v4i8z/qRQBHo/is= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=soICbBBh; spf=pass (imf13.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192053; a=rsa-sha256; cv=none; b=c+/oVd40OlsMLy96ZqxNjmYLugYqZjY/Tvj7UqcV6VX7xri5iCKaFxD7M5WlV5vaV0E1qz wtdN+znP/4fGsb9RF367vEChPm4NA7wx4MtLahKuJQ004d4TDLzmGqgJAdJzyfalI/eigL MHtnudx4yE4V1FA8Mo8VrxI5sCAcVTI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5EF865C4832; Mon, 6 Jan 2025 19:33:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D61BC4CEE1; Mon, 6 Jan 2025 19:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192052; bh=gyDMV+FruyDhiWfk/GjklBAZlivUpb/zLxkaa/kITkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=soICbBBh6s9kcuWQgnfb1X77qFDfSe5g4Wyx2wZ8l/+vVknzQlnb6EOPWet++HK/D 833R1jvhQ3C8nR3Gp9aV+hilEbMoVTzbMW8Fes+p5nijob1BeP6UK06HiAK9ilzY8p H+Ei6gFOZyK2Fy57LuN9MMMgsIHdZYJx8LMjy0gUb82EcxsChqIEJg5xiVZH8wDvMg ocp3tHQf/mtk54LnOUu18i8wSnGKokU+Oq1BVKE0pqGFdM2JZjcVrTRoBQl+4PrvsI 3n2vbt8hCkuqc7/6bUxCmWOovS8Qz+j+eWiv9Kxez3Oj8b9ZFuSBf7UmEBnCzALGub YeKBQnvt/3Kjw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 04/16] mm/damon: ask apply_scheme() to report filter-passed region-internal bytes Date: Mon, 6 Jan 2025 11:33:49 -0800 Message-Id: <20250106193401.109161-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4A8962000A X-Rspamd-Server: rspam12 X-Stat-Signature: z46wmhxi8gpis6npqd8tptzn1ndz7zxc X-Rspam-User: X-HE-Tag: 1736192053-159842 X-HE-Meta: U2FsdGVkX18p/It55p8eonrF29YJ99/9rgqMwFwE6YDUi2PG3JMjZaS7NttIsu1qT0iQBLkb5jod6fcqr8e9C7MBN8YDgbiU2LFCxhuE3IkuGU5mbcAVrQJne23v+X8wImRclDnLPUDLM1JfBcGJV+gq9HdNI+3xHV2xoPJhddgPjWgsbZwLZRvDIvjEHZUj7KHVqv+9tDLck7So8792AFgu40B0x1G6EBbJPleY7o3w5OQiytcoK+d93sd3Yyk3M0HU4QvP3pxwGjjnxw7DHFBW7jdvH0+/bPmizWpy07GJvO4X+kf1miAcKXplMRt2mCgdfNCQKIaVh5GyUnInUaG/MnUtcAL81fbraW7vtPQIgKVSH5T12LVZHUtFqToZOCy09nvsBNEviYiy6GhiVbLzTTSsD9bjIAP4bxNGbeisWVwW72u/nW+LJtHnflrxtlVJYY5pDE4rDWIxJLtmQEy9MnajetInjkzGJIzJUP+CVsqy//pWQg33ju2gVoKdATxgVUCGp+UxXHQ5ltSzL+6P6koSo1vG+Qwtlb4bTPInS56FmujBKtRIiM2O2/XKwF2f2tW9kMXj9UzZJFs+qgGZ4rEdn1RnQgNRYGJ42vvPLb9Cei2Bc/+/0srSY+5SXcEFgpS0QVA1EDPzu0rYbxbb2sNSuNrs8gBXicICCuU4Nhjw96Zhzdbgp5uteghSZPliQ+xRASblwLXg64DUBuzkWUc8O8EDihk9cA/1qLa+7v2o70fNB6IgU3XW2yMuk8WeRzyla1hU9oYg5NpruWMiKxDFmyD7Ie4yDk6ZkvbON0zeEhu3cYldEoP6Yyk7tECBW/thCwIcTJDOFFaR4BiVp8jCC4NsKSwpgWFQhOj2zS9ca4uwOweSipF009QK0v9wNhT620XrI8hOqXTgnuU+uFrreLAnH7dqPInIMABllAkQUS9tRzpFnvA3RjU0XGhKjYwj2Rku9UgWsfR xXjq0giS 8aj70heBNU4Xwv+fCRiYlmXr6GBLP+UCXo8jE7qZhxuChKxJS8/46Pu4ZBzHWPD9NqKkirf1Tgh5P5L40/iZPq/nI3bxSn+G+Ina1WgABh1nsyhW5L8wRTH4Zz0htsEeFmMkuEo+bjXRczizDTMrV6tkiN869kNAqwynR65eaRGOZvlD6tQQuRDPLAMLvdlDyIpKdT6HSxKdacUwx3whwAiNdm2wi37+LMCE1Ri55As4dJigtyp5UM3G84msUOv9PfVCfRjXQGRul62UqXNskohARwQ== 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: Some DAMOS filter types including those for young page, anon page, and belonging memcg are handled by underlying DAMON operations set implementation, via damon_operations->apply_scheme() interface. How many bytes of the region have passed the filter can be useful for DAMOS scheme tuning and access pattern monitoring. Modify the interface to let the callback implementation reports back the number if possible. Signed-off-by: SeongJae Park --- include/linux/damon.h | 5 +++-- mm/damon/core.c | 4 +++- mm/damon/paddr.c | 2 +- mm/damon/vaddr.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index b85eae388f5b..da003173210f 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -529,7 +529,8 @@ enum damon_ops_id { * @apply_scheme is called from @kdamond when a region for user provided * DAMON-based operation scheme is found. It should apply the scheme's action * to the region and return bytes of the region that the action is successfully - * applied. + * applied. It should also report how many bytes of the region has passed + * filters (&struct damos_filter) that handled by itself. * @target_valid should check whether the target is still valid for the * monitoring. * @cleanup is called from @kdamond just before its termination. @@ -546,7 +547,7 @@ struct damon_operations { struct damos *scheme); unsigned long (*apply_scheme)(struct damon_ctx *context, struct damon_target *t, struct damon_region *r, - struct damos *scheme); + struct damos *scheme, unsigned long *sz_filter_passed); bool (*target_valid)(struct damon_target *t); void (*cleanup)(struct damon_ctx *context); }; diff --git a/mm/damon/core.c b/mm/damon/core.c index d02a7d6da855..c6ccb4825c57 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1523,6 +1523,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, unsigned long sz = damon_sz_region(r); struct timespec64 begin, end; unsigned long sz_applied = 0; + unsigned long sz_ops_filter_passed = 0; int err = 0; /* * We plan to support multiple context per kdamond, as DAMON sysfs @@ -1568,7 +1569,8 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, if (!err) { trace_damos_before_apply(cidx, sidx, tidx, r, damon_nr_regions(t), do_trace); - sz_applied = c->ops.apply_scheme(c, t, r, s); + sz_applied = c->ops.apply_scheme(c, t, r, s, + &sz_ops_filter_passed); } damos_walk_call_walk(c, t, r, s); ktime_get_coarse_ts64(&end); diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index a9ff35341d65..3530ef9c80bd 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -477,7 +477,7 @@ static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s) static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, - struct damos *scheme) + struct damos *scheme, unsigned long *sz_filter_passed) { switch (scheme->action) { case DAMOS_PAGEOUT: diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c index b9eaa20b73b9..a6174f725bd7 100644 --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -655,7 +655,7 @@ static unsigned long damos_madvise(struct damon_target *target, static unsigned long damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, - struct damos *scheme) + struct damos *scheme, unsigned long *sz_filter_passed) { int madv_action; From patchwork Mon Jan 6 19:33:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927786 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 28396E77188 for ; Mon, 6 Jan 2025 19:34:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5CCEC6B00A2; Mon, 6 Jan 2025 14:34:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 554F76B00A3; Mon, 6 Jan 2025 14:34:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F5A46B00A4; Mon, 6 Jan 2025 14:34:16 -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 1DFFB6B00A2 for ; Mon, 6 Jan 2025 14:34:16 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id CCEB81A02A7 for ; Mon, 6 Jan 2025 19:34:15 +0000 (UTC) X-FDA: 82978028070.23.345290C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf25.hostedemail.com (Postfix) with ESMTP id 302FFA000D for ; Mon, 6 Jan 2025 19:34:14 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qA9EK67v; spf=pass (imf25.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=1736192054; 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=HhVcQEGzGH+TRle20lu2J+FrSlhsgAp2yCmZVzwMIRk=; b=w7jU39zFXwRNmB7r5tLbq0d65wMG9NUl2xMMERwEnUG+oMlX6sIlmW53OKT9RRFwdYL4QQ L+QvJvhMyRoLGkwms5DPmK7qsOPscOG2fl1iJfvFCaFq6q430HpkEJV0Cke/8Zf22Mv9H0 5dRUs6Y+3eEnCbdWiA1gd7mvLWPLfbI= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qA9EK67v; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192054; a=rsa-sha256; cv=none; b=2KXRz/RUFdErMu4KTlR20g6DEu4T2TQ4X9d1K+Kfbd+JaKBW6BIOB5ypmgI+Ylm7Z2strF pvhnfxpkgfdY6xq407P0OrwKgWiJ1lkOAShdQtxImpdAC0zb+VtpunBjwzRaAbdphAmKRS 9aw9ssqvzz2Av8F7t8gZUmVfdRV97h4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 59F615C495B; Mon, 6 Jan 2025 19:33:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2255AC4CEE1; Mon, 6 Jan 2025 19:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192053; bh=qRmiCMizOQQeo+/I858Y/f5o5hnl0HiSgoRowr7L2/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qA9EK67v2YtDPIKvr5mAQaNXyERVAGH9DAeSw7HlU3+SnipZEqPU6LZF6KliRbYOP I79h9ZLxSPiSD/EB3IHMigjvY1Ov1yW+6CVCj0WlsvwGagWkH4uzAlOd4+S8Pm39cZ Br7cJp0yzFpV41sTA9sg5yw5SwwIXdQIJF2ZNoiDNX5tssjc6dZbuAlPlmxbkwkH4Q HAXF8OjZH7oLTDiQ2Kxe6AwKMbYLl/gVPUkIXQecu55SwRPUvIEmGpaTop9G2/inlU x8yBSdjdkYaHJcd8ICqtI777erM3yFwCWORnnwEPc0Cf87i1oRAMPD+MQxqBX8iUFg VeH8Scq0iQ/Yg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 05/16] mm/damon/paddr: report filter-passed bytes back for normal actions Date: Mon, 6 Jan 2025 11:33:50 -0800 Message-Id: <20250106193401.109161-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> M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Xj6iWg77zHWyCFAIqv8zE3hOY+Et+ mD/4aWiv RJWCFBkWAr4YfeljHclNSahP6ZktYpQJSwCQ6fNycXJ7xEaAaXRrEcx1latCFNHCEB1RB4SGh1Jph75ytqX7xWvTxBN6Qp6VOT3k4Kb6i1lCNxDS1Ovtskzx7Yc+IFOZq5t69hE9UU9xaaU8xxYIN36grwLi2rzJlawaQQOTZKqGD6pQCOal35TTWcAwDimpckxPTJ5EZPIP6Xpz4+KJuAJaVndRykXYDyHgVliE3/OTXatQ= 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: damon_operations->apply_scheme() implementations are requested to report back how many bytes of the given region has passed DAMOS filter. 'paddr' operations set implementation supports some of region-internal DAMOS filter handling for normal DAMOS actions except DAMOS_STAT action. But, those are not respecting the request. Report the region-internal DAMOS filter-passed bytes back for the actions. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 3530ef9c80bd..5944316a0b4c 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -243,7 +243,8 @@ static bool damos_pa_filter_out(struct damos *scheme, struct folio *folio) return false; } -static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) +static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s, + unsigned long *sz_filter_passed) { unsigned long addr, applied; LIST_HEAD(folio_list); @@ -272,6 +273,8 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) if (damos_pa_filter_out(s, folio)) goto put_folio; + else + *sz_filter_passed += folio_size(folio); folio_clear_referenced(folio); folio_test_clear_young(folio); @@ -292,7 +295,8 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) } static inline unsigned long damon_pa_mark_accessed_or_deactivate( - struct damon_region *r, struct damos *s, bool mark_accessed) + struct damon_region *r, struct damos *s, bool mark_accessed, + unsigned long *sz_filter_passed) { unsigned long addr, applied = 0; @@ -304,6 +308,8 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate( if (damos_pa_filter_out(s, folio)) goto put_folio; + else + *sz_filter_passed += folio_size(folio); if (mark_accessed) folio_mark_accessed(folio); @@ -317,15 +323,17 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate( } static unsigned long damon_pa_mark_accessed(struct damon_region *r, - struct damos *s) + struct damos *s, unsigned long *sz_filter_passed) { - return damon_pa_mark_accessed_or_deactivate(r, s, true); + return damon_pa_mark_accessed_or_deactivate(r, s, true, + sz_filter_passed); } static unsigned long damon_pa_deactivate_pages(struct damon_region *r, - struct damos *s) + struct damos *s, unsigned long *sz_filter_passed) { - return damon_pa_mark_accessed_or_deactivate(r, s, false); + return damon_pa_mark_accessed_or_deactivate(r, s, false, + sz_filter_passed); } static unsigned int __damon_pa_migrate_folio_list( @@ -449,7 +457,8 @@ static unsigned long damon_pa_migrate_pages(struct list_head *folio_list, return nr_migrated; } -static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s) +static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s, + unsigned long *sz_filter_passed) { unsigned long addr, applied; LIST_HEAD(folio_list); @@ -462,6 +471,8 @@ static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s) if (damos_pa_filter_out(s, folio)) goto put_folio; + else + *sz_filter_passed += folio_size(folio); if (!folio_isolate_lru(folio)) goto put_folio; @@ -481,14 +492,14 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx, { switch (scheme->action) { case DAMOS_PAGEOUT: - return damon_pa_pageout(r, scheme); + return damon_pa_pageout(r, scheme, sz_filter_passed); case DAMOS_LRU_PRIO: - return damon_pa_mark_accessed(r, scheme); + return damon_pa_mark_accessed(r, scheme, sz_filter_passed); case DAMOS_LRU_DEPRIO: - return damon_pa_deactivate_pages(r, scheme); + return damon_pa_deactivate_pages(r, scheme, sz_filter_passed); case DAMOS_MIGRATE_HOT: case DAMOS_MIGRATE_COLD: - return damon_pa_migrate(r, scheme); + return damon_pa_migrate(r, scheme, sz_filter_passed); case DAMOS_STAT: break; default: From patchwork Mon Jan 6 19:33:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927787 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 E1959E77199 for ; Mon, 6 Jan 2025 19:34:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B4DF86B00A4; Mon, 6 Jan 2025 14:34:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD4096B00A6; Mon, 6 Jan 2025 14:34:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B1F46B00A5; Mon, 6 Jan 2025 14:34:17 -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 6616A6B00A3 for ; Mon, 6 Jan 2025 14:34:17 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DEEFB80292 for ; Mon, 6 Jan 2025 19:34:16 +0000 (UTC) X-FDA: 82978028112.28.15FD7C9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id 4F6D5120006 for ; Mon, 6 Jan 2025 19:34:15 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YGjmLeiU; spf=pass (imf29.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=1736192055; 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=g71QxxRLtmP+EXQFUXo44lgeKTrfyrK5oGSS4WBhddU=; b=lHKY+nJ5djhKU3thhe4zYs7REMC7VPoyaK7AF2f4pPNKl+1r1N37vhHjxzbPyTLjj4WW6H hFKCpYZyhZIEt6Sc1aWaYH9cNi6HrdKLpxDXe9XigaAypPOgZV1pzrT06V1zBIQyqNvQIL Ay5f/yyKCXbt0HyZZ6IAxbvUAAmZOvo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192055; a=rsa-sha256; cv=none; b=ieATX3qAt/cyH4V/DP/Cl5GMmbSJH2qD9H0EuWpKKXS1FY4DCh9Ua4zlMmQFx0CfXS26/o PysVPP3GQY70QumM4MSWbSpdcg1RhMy0m1TVfUWGAdkWpHpMF2n7vMyV05JHwCbb/qih+p G7LDIlkIPYk29ykU1+fkxBYfodnIMS0= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YGjmLeiU; spf=pass (imf29.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 787465C503A; Mon, 6 Jan 2025 19:33:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EF43C4CEE1; Mon, 6 Jan 2025 19:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192054; bh=g81jBx5R64ofCs/+zCq5N7Um6JZR0CPZvNzSfSj4qFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YGjmLeiURNXmHa2AE4peDuREnuTW8zRsFNpulcMswaELc6PGc9Thi5MSy4pRcfEzn prnaEukjxB4D2DBQAqTf0n6CLUxIb2pnX8x4ylZ4KCCPuJPq5STZ0By3fzSMwpjBA2 kxXFjcPHlxZqKc6Xf1DNVnauc8ZNUSUh7Qr2wUZvcklzHpPmy4Dxf5qEpt0Uo5r7zx y9kZng7r2YoCsAMCI5ulud68kZpexiwHJkwhRgiGByRa1kVWNtkgQ08Oohzh9NOXou T5uHsUNn4nhnGX/zzC9QsM5FA9KXZdf+iMcfG6jeZNwrFbWLWGQu7yjSMrVnStIHrw h+QOw4chsZINQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 06/16] mm/damon/paddr: report filter-passed bytes back for DAMOS_STAT action Date: Mon, 6 Jan 2025 11:33:51 -0800 Message-Id: <20250106193401.109161-7-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4F6D5120006 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: wowy1gj6exandfh4z79ah54eeo5tqwnt X-HE-Tag: 1736192055-609691 X-HE-Meta: U2FsdGVkX1+L0yNpS2wxjSmbFYAlt/liOHkREWZTXGPNvD7cDvlOhulaNLtlU3aE03KJJ5KQ2HLRLTf12I8WW3/wI1Az7/erAeYQvH/ExB5wbohbXdSdt2Pza2HIaj+7a7lwCJtJvxnCzyG8PEAqO7aH5g9undzRoRNZsZ2ZCzcgVwez0Ty30zxnju+q9OCH9GzQhxni9GGCs2e85uroZMA3tC89L2AH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=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: DAMOS_STAT action handling of paddr DAMON operations set implementation is simply ignoring the region-internal DAMOS filters, and therefore not reporting back the filter-passed bytes. Apply the filters and report back the information. Before this change, DAMOS_STAT was doing nothing for DAMOS filters. Hence users might see some performance regressions. Such regression for use cases where no region-internal DAMOS filter is added to the scheme will be negligible, since this change avoids unnecessary filtering works if no such filter is installed. For old users who are using DAMOS_STAT with the types of filters, the regression could be visible depending on the size of the region and the overhead of the installed DAMOS filters. But, because the filters were completely ignored before in the use case, no real users would really depend on such use case that makes no point. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 5944316a0b4c..b0c283808ba6 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -485,6 +485,39 @@ static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s, return applied * PAGE_SIZE; } +static bool damon_pa_scheme_has_filter(struct damos *s) +{ + struct damos_filter *f; + + damos_for_each_filter(f, s) + return true; + return false; +} + +static unsigned long damon_pa_stat(struct damon_region *r, struct damos *s, + unsigned long *sz_filter_passed) +{ + unsigned long addr; + LIST_HEAD(folio_list); + + if (!damon_pa_scheme_has_filter(s)) + return 0; + + for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) { + struct folio *folio = damon_get_folio(PHYS_PFN(addr)); + + if (!folio) + continue; + + if (damos_pa_filter_out(s, folio)) + goto put_folio; + else + *sz_filter_passed += folio_size(folio); +put_folio: + folio_put(folio); + } + return 0; +} static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, @@ -501,7 +534,7 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx, case DAMOS_MIGRATE_COLD: return damon_pa_migrate(r, scheme, sz_filter_passed); case DAMOS_STAT: - break; + return damon_pa_stat(r, scheme, sz_filter_passed); default: /* DAMOS actions that not yet supported by 'paddr'. */ break; From patchwork Mon Jan 6 19:33:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927788 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 7B26DE77188 for ; Mon, 6 Jan 2025 19:34:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 88BF36B00A5; Mon, 6 Jan 2025 14:34:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 83CD36B00A6; Mon, 6 Jan 2025 14:34:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6DC276B00A7; Mon, 6 Jan 2025 14:34:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 486076B00A5 for ; Mon, 6 Jan 2025 14:34:18 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 10978AE6F0 for ; Mon, 6 Jan 2025 19:34:18 +0000 (UTC) X-FDA: 82978028196.08.AD25F16 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf20.hostedemail.com (Postfix) with ESMTP id 75E2A1C0017 for ; Mon, 6 Jan 2025 19:34:16 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gAYIhQk+; spf=pass (imf20.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=1736192056; 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=pR5h4DC6BpAl2A1XklNIIg7rh2vXbyRzmbAD51vFfQQ=; b=eE+MbvxKh+QYtM6kRjUQz52iZA5+Ps52Yqjby845DRwwtFtdJY+A3NBMKAgOF4v9SVkibg dkKDugtXwHbfQgyXHaVgyeAfcMVtIbcD1Eup+ytSGoli3jIV+fUtgaSC3VmfSJSyFoB+1L /LdHs7AUB4virQ86AOmmTyGVYxIvWJQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192056; a=rsa-sha256; cv=none; b=cZMldAZ35MuOMoJOdL06aMiXVQhuFwYozReIkf9K3aIFn02hAXWjhTbT6Ji1k77rZB0+fa 8tmLh2e6QF2P2YtNym5QN7tYGUgNRbnAQKPmh2+ZuUjwq8Gwb4PLaxXn6jq9BdOfDbC8Lm rOIoAYb9sOgcLfH7Ki8+RQ+jqbx8wTM= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gAYIhQk+; spf=pass (imf20.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 0DEBEA418F5; Mon, 6 Jan 2025 19:32:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66CE4C4CED2; Mon, 6 Jan 2025 19:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192055; bh=2LH1SS+mcAmlUxCwzoptXsvLS0Q9wTfZdyaAciByRN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gAYIhQk+ZNsHH1AnWzsQzrhkNcdktCCWYi8JwOkrZT2ipR6JsnMpZyThIUdGJwJJ2 m/6qUBaDjKqS5CPI3GgUipsWQJVyTRunXGG7Fi89wrukN65NVpMsLW31CPl+qnHozZ GkvF8Vx1AJIjOP0tsLZtYWeWpcPtc/BTrTkEyDlCeeR39HCLh8u4jQdIie0GAXynQC yNg8FYT63DxRJa5SY7VV/4CVV/0ELLoPG1zaTNXYuPGa+uaCSSWHAqxbrEIh0+5ZwI c3ZyQq5uE1liDUXvdmCx443KSGnIyAm6JvOsVQNTgsNepYr0TPkMc2rr+0ZSy/bziT Y3gfvMfiLQJ6A== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 07/16] mm/damon/core: implement per-scheme ops-handled filter-passed bytes stat Date: Mon, 6 Jan 2025 11:33:52 -0800 Message-Id: <20250106193401.109161-8-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 75E2A1C0017 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: 8743uc7jqaej1og9ufayieqyf55m6p4f X-HE-Tag: 1736192056-640559 X-HE-Meta: U2FsdGVkX1+25lZyP0QAKkj+bSwHduxn5kSuiJKl3NW6r1OODVZfgy9OaRFV43ShxPdNK/MkBwp0Eg6bI9YQl3iKT7Eb/hIlSIFKlz+p3Atf9cvy3JLSUWLQ+zjHHIzJ3e3BvNp0gU576Y9pDb5oh8zmWfcrBWFz77byppM7YeXs6OwH49sNIFY2d8Sc19/ArpQHeZ6+p+cu7CwJ0cFRzRgFVx6Xf5g9WZV9x12nf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edence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Implement a new per-DAMOS scheme statistic field, namely sz_ops_filter_passed, using the changed damon_operations->apply_scheme() interface. It counts total bytes of memory that given DAMOS action tried to be applied, and passed the operations layer handled region-internal filters of the scheme. DAMON API users can access it using DAMON-internal safe access features such as damon_call() and/or damos_walk(). Signed-off-by: SeongJae Park --- include/linux/damon.h | 3 +++ mm/damon/core.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index da003173210f..2a93dbe06ecc 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -286,6 +286,8 @@ struct damos_watermarks { * @sz_tried: Total size of regions that the scheme is tried to be applied. * @nr_applied: Total number of regions that the scheme is applied. * @sz_applied: Total size of regions that the scheme is applied. + * @sz_ops_filter_passed: + * Total bytes that passed ops layer-handled DAMOS filters. * @qt_exceeds: Total number of times the quota of the scheme has exceeded. * * "Tried an action to a region" in this context means the DAMOS core logic @@ -310,6 +312,7 @@ struct damos_stat { unsigned long sz_tried; unsigned long nr_applied; unsigned long sz_applied; + unsigned long sz_ops_filter_passed; unsigned long qt_exceeds; }; diff --git a/mm/damon/core.c b/mm/damon/core.c index c6ccb4825c57..c4ce72a86d81 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1362,13 +1362,15 @@ static bool damos_skip_charged_region(struct damon_target *t, } static void damos_update_stat(struct damos *s, - unsigned long sz_tried, unsigned long sz_applied) + unsigned long sz_tried, unsigned long sz_applied, + unsigned long sz_ops_filter_passed) { s->stat.nr_tried++; s->stat.sz_tried += sz_tried; if (sz_applied) s->stat.nr_applied++; s->stat.sz_applied += sz_applied; + s->stat.sz_ops_filter_passed += sz_ops_filter_passed; } static bool __damos_filter_out(struct damon_ctx *ctx, struct damon_target *t, @@ -1586,7 +1588,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, r->age = 0; update_stat: - damos_update_stat(s, sz, sz_applied); + damos_update_stat(s, sz, sz_applied, sz_ops_filter_passed); } static void damon_do_apply_schemes(struct damon_ctx *c, From patchwork Mon Jan 6 19:33:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927789 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 ECE1FE77199 for ; Mon, 6 Jan 2025 19:34:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A61966B00A6; Mon, 6 Jan 2025 14:34:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A10676B00A7; Mon, 6 Jan 2025 14:34:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B13A6B00A8; Mon, 6 Jan 2025 14:34:19 -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 6A9536B00A6 for ; Mon, 6 Jan 2025 14:34:19 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 26C72A0229 for ; Mon, 6 Jan 2025 19:34:19 +0000 (UTC) X-FDA: 82978028238.15.7DB6151 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 8B03A4000B for ; Mon, 6 Jan 2025 19:34:17 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AaxbcO1N; spf=pass (imf27.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=1736192057; 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=wKALUXA5KOlaxQuesRY7XJJ0y9IguV010vsxGpJLWbY=; b=efs1Z4R4h97dchrSb4uYNSKab69g/J4uoDe8mQ256/23TYNA0/QAmOzS1hNqbOBUDJZpX9 KEUmLvzdo5DOeCEGYCpzEpIbzQit4MJsLTJA1fgAMKxUsqp90bJLNEmRPks4G4NOy7yXRA 0FrQX7PPPl9zT64EO7gOkhA8Xxqc58g= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AaxbcO1N; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192057; a=rsa-sha256; cv=none; b=PSsw3TN6UwOVIfEAvEfUppYD3MIAkhsKkm9N7Drxor2hm9UG0+eNmSxSTP/2oJt1xYmZJ4 rbeZyAR0R+j9zJBbQlvwaGE+XbL4/IENntcvIFD/J+j2+ovPxViCHT8yNdLi9I7l5cqPpG tTM6sIWicUZnchTizzkvFoWKerD+pgs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B13B35C503A; Mon, 6 Jan 2025 19:33:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E02DC4CED2; Mon, 6 Jan 2025 19:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192056; bh=ftF2xdlxRC1hxynZygPWzsGSDwQOUYQsL2NA51xCWlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaxbcO1N74CCY8kGmY2WADbvphzHKKpytGuMvPR+8lLiwQOlrunTi2X5WMv8mkVzG MLg4dKAmhV42dJUeoYrmpyEEFHWwH4mF2COFSKwS+2FCZTgnDRIgqNipLyjJSyILbP CP6qSW5byI7JNIOoaTR3LSLiNLPhjLq2ky0gOcp7FimS5C4ttM/18Piv75DbSK44U9 4UqSZPGvVZV5I5rTJE4KWmziN/MC3hgZV1MwI6NTDDdJo4C/BBCNCD0ZKGFQaTV2VL y64Bw8WUbCxqcI2O94lTR0AUQ/Kf6C5bLiyD+T1mWvpdcpgZmnQocTuL7F5MQzw6gp oVSWWuDz05Xwg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 08/16] mm/damon/syfs-schemes: implement per-scheme filter-passed bytes stat Date: Mon, 6 Jan 2025 11:33:53 -0800 Message-Id: <20250106193401.109161-9-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Stat-Signature: 8ap7hkwwjns11booopfd4mjtyg77ghsy X-Rspamd-Queue-Id: 8B03A4000B X-Rspam-User: X-HE-Tag: 1736192057-490855 X-HE-Meta: U2FsdGVkX19Lg9mFiNLNdWWhXSImREfS7V6fXttkE9EUv7lun4xK82mV3/y2Zt1JmX6pBJAyOX8ZS2adxheEW1Xh+j1mRVeRVM0IMwkqzWJ7+6kvsC1yFmcuixLy7yrIox9IpbchbcgKI+JrVbH1djmhY4jQVPu6fTqnikzOtp33vv0AckRXGWkoxTmBRwdZBUUs3sT7zD+z8WXPmV/G6l4tASHp8z2+Kngw9tGTfzZ4DPMcouFeBZYX4mXvwX1HcTBbq5N1ZaQK9uozJOupREkMXvzrScmRqlSOu2lxIID3jBY0jJDj5tlfQozL1Eirp3IrzdMtiMQ2e/ZSuZ6b9xFUahItTjk4iKE6QYiipp05/W6Xx26EE2tMcDzIP2pDX1R361G8ntPASO36OLfmthcUKd9vFUiSxa/h8/1T1EOlesBXPGo0HGFp/p4UBeuDWYTdcs9sh8zDAVzN9jO5gkuCsCel1OC6vkqwGPcxm+hRZJHxaRAJ20EUYy95DFU1tcdSxazTnrdK94eOm3A0oxOYvtlXcHBeV6FUTr8WmPJyi6e88I95JriPQ32QMi/VN+cXzmgADYpcnQVtS/qTGPd5sKy4jWhA0+yAaFRpou5TDF9od2O+cM9cVn6gNEna+zXoxDrE/z37rdyi/Wm7G7sKpngPteN0OXNASFYTR1KE52nBM8iFyomsCCuU3qPKxGuNsi8CrSAezoZMIVUiefCANHDUz18cX+DcxI7tkwLoQZcy0P3CcdMMOTdVRJM8HsOXb1udS6U9lAFabW7h4hfg2RDrG/sYLOm13U4vXNesaXH382np2Ydb2RjtYjXdisdnmFwGvkKa5FHRKvIyu51+rWLOjtgCMjSKE9hH+iNlEhp4vvAMj7qw4veR3gQ5EPL1jQvDrKWWyhU6JpiyyEKQDGIqtN7iVGg0pjamkdngoVmox4p1AgwzixhWWJSw6rwdFDcupKBxPM67cgi w2q2zCYu Pp0Ymtvk0JX8IIRd0ofuAUTJz15Ialibe8IaRPfvKlNrZ8Q+MrWrqQXcb/sWfWf+Fn6swHe1Nly5ILtPCeQYLPNLzG/q3pG+xL4lfAyu9uR6tA1wNU40YsOONMghahSOwvbuyiEd21Tm/h5MCg90eyN6YVWTH1K+9jEj+z5vxc0IBheXE0UB+AnwgULJEdGRvPTW/d6Yja8lkzJfJW7Ik42cHGCX+0XRsTc4UsTrsQceRGyk= 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: Add a new DAMON sysfs interface file under scheme stat directory, namely 'sz_ops_filter_passed'. It represents total bytes that passed region-internal DAMOS filters of the scheme that handled by the DAMON operations set layer. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 5c4490b97258..b447c412b02c 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -188,6 +188,7 @@ struct damon_sysfs_stats { unsigned long sz_tried; unsigned long nr_applied; unsigned long sz_applied; + unsigned long sz_ops_filter_passed; unsigned long qt_exceeds; }; @@ -232,6 +233,15 @@ static ssize_t sz_applied_show(struct kobject *kobj, return sysfs_emit(buf, "%lu\n", stats->sz_applied); } +static ssize_t sz_ops_filter_passed_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_stats *stats = container_of(kobj, + struct damon_sysfs_stats, kobj); + + return sysfs_emit(buf, "%lu\n", stats->sz_ops_filter_passed); +} + static ssize_t qt_exceeds_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -258,6 +268,9 @@ static struct kobj_attribute damon_sysfs_stats_nr_applied_attr = static struct kobj_attribute damon_sysfs_stats_sz_applied_attr = __ATTR_RO_MODE(sz_applied, 0400); +static struct kobj_attribute damon_sysfs_stats_sz_ops_filter_passed_attr = + __ATTR_RO_MODE(sz_ops_filter_passed, 0400); + static struct kobj_attribute damon_sysfs_stats_qt_exceeds_attr = __ATTR_RO_MODE(qt_exceeds, 0400); @@ -266,6 +279,7 @@ static struct attribute *damon_sysfs_stats_attrs[] = { &damon_sysfs_stats_sz_tried_attr.attr, &damon_sysfs_stats_nr_applied_attr.attr, &damon_sysfs_stats_sz_applied_attr.attr, + &damon_sysfs_stats_sz_ops_filter_passed_attr.attr, &damon_sysfs_stats_qt_exceeds_attr.attr, NULL, }; @@ -2077,6 +2091,8 @@ void damon_sysfs_schemes_update_stats( sysfs_stats->sz_tried = scheme->stat.sz_tried; sysfs_stats->nr_applied = scheme->stat.nr_applied; sysfs_stats->sz_applied = scheme->stat.sz_applied; + sysfs_stats->sz_ops_filter_passed = + scheme->stat.sz_ops_filter_passed; sysfs_stats->qt_exceeds = scheme->stat.qt_exceeds; } } From patchwork Mon Jan 6 19:33:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927790 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 4608CE77198 for ; Mon, 6 Jan 2025 19:34:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D951D6B00A8; Mon, 6 Jan 2025 14:34:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D1EB66B00A9; Mon, 6 Jan 2025 14:34:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC0366B00AA; Mon, 6 Jan 2025 14:34:20 -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 8F8D86B00A8 for ; Mon, 6 Jan 2025 14:34:20 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 46ED41C6A5A for ; Mon, 6 Jan 2025 19:34:20 +0000 (UTC) X-FDA: 82978028280.12.E17E23A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id AC5F21A000E for ; Mon, 6 Jan 2025 19:34:18 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VhE5uq9D; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf19.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=1736192058; a=rsa-sha256; cv=none; b=79IsgEfgBjZ2hbm8/hu27tvbe3tAcAjenXrJiVTEFpLGsfnbTPjEMesFx3/XQELpCOyyiC 6vaMzBFknpcwwy17WVGojS+7Li7jI/gvrPD6s5yRJM1QorH+tc5vbtjtnCiEdGRHNgfUxh fqFd8iAu+ko/tWtFnIugoPpUmN+RA3I= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VhE5uq9D; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf19.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=1736192058; 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=1wkLQ+xuiohVMOoRb5CJDD+U/iK6MFRBh8zOD+pV/iw=; b=1+C5GhNOsHeisq4pbADLWxsvMsNUgQrxRM3h7/aiwtZCnvmBtDb9RyPZjtc5XsA8dCC/nm 6j2FP0xfXtJ3rRznSgqNHSDRaZTKKgKR7Nzjts5lJrnkvY8SuHIp39S0DybETMARY6wghy 4rEbn5731tUt4fxWaMYFgvfHRt1qffg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C503C5C5431; Mon, 6 Jan 2025 19:33:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B9A3C4CEE3; Mon, 6 Jan 2025 19:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192057; bh=oFPXEWb9JL0M/GNEujeFNfcJBtpZBlejNr2S5S6yqXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VhE5uq9DamFxNfZYqsSpq0lvAYvPr3uAJ4ockYbe/7+0yn95MTpHYGsUOvea3ZvWO s4klGcX5zL0QGDkzE22qLtLc0qpOvD87gq+4P5bZ/Lfr6+VuziqYK7WnrbYWZ8g+zv VXE6QFZMXs/bK30osi73P64aXhhMCzKlQ4Q0oCLh9A013zBnjUkss/Y5RrAIUmxEEk brgb2rgFk0nWbuD9sXaCuK7bF4dO4Z1VWCHWCaExeBDoF/AvYu9JPRexo2oZ30gXia 8sfWPJ5F68beNYGku2YU37vrQLL6O4NS3wbQSD2ifIq0aVyX+Cd7y9cQ10Xxg5Lvvm jrmDK//yvN8IA== 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 09/16] Docs/mm/damon/design: document sz_ops_filter_passed Date: Mon, 6 Jan 2025 11:33:54 -0800 Message-Id: <20250106193401.109161-10-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 1rhp31xpc7bcnj8uqyns7zoy5hpxdrkz X-Rspam-User: X-Rspamd-Queue-Id: AC5F21A000E X-Rspamd-Server: rspam08 X-HE-Tag: 1736192058-350653 X-HE-Meta: U2FsdGVkX19e4qG0hJ/e+a5zzY37vtuUAALifEUuN6puJvyRggHvWSsiqSc75UKjqihL4e4esE4PqB1MlAvzr4gnNXl8zK9qSpWyrZQ33G/JL5m7BDdBgt2hrLBX8OmZrub6p9yUZ94CH4yQI5N16VOdH6BMEj39AJhp1QIYB+aIri7X/Pd8sOSA9qI7pFOxEKY7pBf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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: Document the new per-scheme accumulated stat for total bytes that passed the operations set layer-handled DAMOS filters on the design document. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 158d0a4e1d7f..68145972cb20 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -552,6 +552,8 @@ scheme's execution. - ``nr_tried``: Total number of regions that the scheme is tried to be applied. - ``sz_trtied``: Total size of regions that the scheme is tried to be applied. +- ``sz_ops_filter_passed``: Total bytes that passed operations set + layer-handled DAMOS filters. - ``nr_applied``: Total number of regions that the scheme is applied. - ``sz_applied``: Total size of regions that the scheme is applied. - ``qt_exceeds``: Total number of times the quota of the scheme has exceeded. From patchwork Mon Jan 6 19:33:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927791 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 864FBE77199 for ; Mon, 6 Jan 2025 19:34:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 383396B00A9; Mon, 6 Jan 2025 14:34:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E59B6B00AA; Mon, 6 Jan 2025 14:34:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 139CE6B00AB; Mon, 6 Jan 2025 14:34:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E53B46B00A9 for ; Mon, 6 Jan 2025 14:34:21 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A4D39AE7F8 for ; Mon, 6 Jan 2025 19:34:21 +0000 (UTC) X-FDA: 82978028322.14.3FD7D37 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf04.hostedemail.com (Postfix) with ESMTP id EC25A40002 for ; Mon, 6 Jan 2025 19:34:19 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sxC7kO10; spf=pass (imf04.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=1736192060; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=A3se7PLXJCnWzFggBLeTs9MNVwVA8FKPjsAQ++/xeJk=; b=Oim/CX/6nw5GkDRZIMIb0u1S900zOyvvsDF7rCbbjLNmKlyL/F6s1zUYOfUVf5ao7FPsFy ylbXxRe7IBljxFGo3hCtjeTEpDZBVEq/5PovAXJMufe+K4BNwE1doKN1pJ2+ksggsE8w5F gBgUa+It9Ojy7QclNsFY13Z9X6482oA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192060; a=rsa-sha256; cv=none; b=Aa61E9QlB2NKaf7AxGMiPoFCPjccdSL3HJ/Of5mvgekL7ujeWyw9pTz61LR5grJmBC7VNo 2nKffwHAfr+rbpwQC5eDSjqCXoKwTSVdciwsMztOp5amQ/RF8mAGdBKHO96eVRPZkWesMa cJXZxSW7kCY0Vw1iwmj/tHywQaB57Fg= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sxC7kO10; spf=pass (imf04.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 EA1D05C401D; Mon, 6 Jan 2025 19:33:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EBE4C4CED2; Mon, 6 Jan 2025 19:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192058; bh=/5ferqdIUHJtb9RUNwfrb+SM/R7GDkwn6D3djVY4NbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sxC7kO109urARAN/IKaIe5KGU3QthanXoODO6MLv0hb+ybBedxofLTMJ8e1RvRgDf 5b94o5op7f+O+m8QwnMLLB9wYjuRNf+pmiQHyP/efPt/KnXwyqckrxNreR5NdWAVom by4llLLglMagZmsZeM+0kom2SmvHWhPaLRSf4W0/w1XsVy0vMXsi3a9AmWCNbu+Arf pBbMfHZCAVzNbNPnSEjUvrNKn77N2uUj/aPIFglFYrclCTN/dDoBo/b9WgCDHG/xOS 6tvHh5L+PQCqlLJSqeEgytkeUXS6izaTje5mnRoUkv4/pPp0phfO3Cao8sjduLbZpG Pc1G/Cu17M5yA== 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 10/16] Docs/admin-guide/mm/damon/usage: document sz_ops_filter_passed Date: Mon, 6 Jan 2025 11:33:55 -0800 Message-Id: <20250106193401.109161-11-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: EC25A40002 X-Stat-Signature: snmxjzq4sf6qg7zd4mgyomi1cwjb4zr4 X-Rspam-User: X-HE-Tag: 1736192059-251823 X-HE-Meta: U2FsdGVkX1+8vwFRd31NK238EHu81xxfsCm01S5Di6FEfJ7t/LJLJTY6exFrLR0cPWfaVW5tiV9+NfbfQMF9HJ3WcRx12Wo6iMoMmRlkXiEGdt1n5a6xTbQZvmUBTd5o7V2611UvkdmSMn0lZnmKtoPZS2/MmJxlo3jQ+kqnScFkWEgovFya0iT3nalrZWYvtkdZ/qxyc83MWcSB7pTMbouE1NwiUuCJ6zEb8HWMz56QLcjgG5shhYMnUJHue67eh7EDA4malc49FQ7kiu/Zga06n7YJ5r5PtHzFx9DonYDu+unXzNuWhd9+1pgJe9tuUml/ohw1GPVZWKSvhl6Qy8dkq39FQpP/h74S9LiBdTvm99ygkley/r3+wfnwMHjt6jDCP0A22yWtE6cjnGS0xMGJW2qDEPmyfS59zbQZ+qed8c4pbIkGHbj7ylEFVgZUumVbqCHEhNiCJW5RIi2kbx4vSrOAS+knrWBJXw4XlT+6iOKy90zqmsJmF3hrMumzmFT+kfSCUjKPfVnOgEfoeroxW7EUK1FLpaPvYHZ4Gvc4g4JcE2QGh3njpbzkx8HNr2Op+XooKsFC+HRDIEH41AQyIO7vXgQwPYXLKAoyGqFO5vuoD7nFfxLh2p832rJ7YnPuMtuYmmsZbkkGd7zSXObXoLz+pYHQ9jYocn+aDZcfJxXqRlzGoVAvQ5hXCdPVU7S3+1pSa4cn5/BHhXko97FwWmhR8oZDU4YnlBt/gyAS/KoShhK7a4hRa79vP/pawxKxpjJLTb/p1pUytoCivM3OLeN3EFPokbPJD8eHs6RLzoAQw7DsYjPFfgD4DIVU0N9F9XPHCKvCPYPwVYTUMn/Pa3DRhp7s8FzXJPqRdKNvoc00cxXrilYQ793E6ToDfaGjtkNNznnf1lHErCGnSPV3ALGZqdrmB+xGIu2ABEkHpYHQsaQPQ2fd1I25xrwTPFTehp9h+M/JVItTrtX fTGktuME mGngKDdrxJ3pWuwW4WDjsfooZnDNMhkYKoFBjRDGl+PHjB2C+I71U8qdXjuUPhX0pYh5gaDBoJayocsZTvhsxqo37jS7mfyBmuqXUsvuWVkwISb7lJq6duUnK7LuaiyAfHqA1/POcoHkwvZPXBwgxWkS6IitLsuUJy/eYGSIxlxb40i9Y+IO9KQ5iaUqpLj6Nk1pr85+AvyfRHuMy09KuyMqZJL09eri6der5SQJrlt9LqG+8D7ss+ApUY4LDsn70Siein5YXrrsamqyUBcsUPSuZehrON70NwG2sVj69bL/EedrdmEzR5X1k4aZS7IBzrEL+jq8IJPEAppc/HI2aull9+qCxNg01e5Ua 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: Document the new per-scheme operations set layer-handled DAMOS filters passed bytes statistic file on DAMON sysfs interface usage document. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 2e835c9bcfdf..95c174be9c06 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -84,7 +84,7 @@ comma (","). │ │ │ │ │ │ │ :ref:`watermarks `/metric,interval_us,high,mid,low │ │ │ │ │ │ │ :ref:`filters `/nr_filters │ │ │ │ │ │ │ │ 0/type,matching,memcg_id - │ │ │ │ │ │ │ :ref:`stats `/nr_tried,sz_tried,nr_applied,sz_applied,qt_exceeds + │ │ │ │ │ │ │ :ref:`stats `/nr_tried,sz_tried,nr_applied,sz_applied,sz_ops_filter_passed,qt_exceeds │ │ │ │ │ │ │ :ref:`tried_regions `/total_bytes │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age │ │ │ │ │ │ │ │ ... @@ -448,18 +448,16 @@ difference is applied to :ref:`stats ` and schemes//stats/ ------------------ -DAMON 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. Refer to :ref:`design -doc ` for more details about the stats. +DAMON counts statistics for each scheme. This statistics can be used for +online analysis or tuning of the schemes. Refer to :ref:`design doc +` for more details about the stats. The statistics can be retrieved by reading the files under ``stats`` directory -(``nr_tried``, ``sz_tried``, ``nr_applied``, ``sz_applied``, and -``qt_exceeds``), respectively. The files are not updated in real time, so you -should ask DAMON sysfs interface to update the content of the files for the -stats by writing a special keyword, ``update_schemes_stats`` to the relevant -``kdamonds//state`` file. +(``nr_tried``, ``sz_tried``, ``nr_applied``, ``sz_applied``, +``sz_ops_filter_passed``, and ``qt_exceeds``), respectively. The files are not +updated in real time, so you should ask DAMON sysfs interface to update the +content of the files for the stats by writing a special keyword, +``update_schemes_stats`` to the relevant ``kdamonds//state`` file. .. _sysfs_schemes_tried_regions: From patchwork Mon Jan 6 19:33:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927792 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 E9CF5E77198 for ; Mon, 6 Jan 2025 19:34:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 139C06B00AB; Mon, 6 Jan 2025 14:34:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 09B166B00AC; Mon, 6 Jan 2025 14:34:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E07776B00AD; Mon, 6 Jan 2025 14:34:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id BCF176B00AB for ; Mon, 6 Jan 2025 14:34:23 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 703ABC0264 for ; Mon, 6 Jan 2025 19:34:23 +0000 (UTC) X-FDA: 82978028406.15.679DA2F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id D2B3A40003 for ; Mon, 6 Jan 2025 19:34:21 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hCTv8uZx; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736192061; 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=fp/M5qtlpa5xEAVPBJdPeMW9+kyBozw/GmAvcT1Vf1I=; b=1QZn2H6BKW7ZwC6GTLznTERgcMJUF8P5YNaWNknW7KY/TuXYwjGRco9kyXdXyjEmOhmow7 VrQba/PScpwzf2uQx2QMNjFkwjJo4phO4OowJ5Z4cgQiptwwGclcXK4p071ci5P+S/GFRR UvSoIMPxBwbBP5FrM7afuvZRY+dk4iA= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hCTv8uZx; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192061; a=rsa-sha256; cv=none; b=v9qXNAXe0bMpCKCJpAjF2CBdYgOwpg3K3WjZx63s2AoV/cfcOEeJewcEs0OgiX73IavHFp jegQJ+9f6d8lAYFJX94ANYcwyn4I6HEaakOGQiyt2wVOpin86oSSp82hLs74vU1g49bb3o th8LitSuAaK6TBonJOUU6uoTdzHG3EU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EDEB45C483F; Mon, 6 Jan 2025 19:33:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AAD3C4CED2; Mon, 6 Jan 2025 19:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192060; bh=SpnwWXRTfkYMqczlFfBjIRSLjyD9BiybsCKabnuSowk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hCTv8uZxErf78ZprG1RO+MaAdn/+YumcxlEMOAndzJSx0NLXFCOgWo+Tc9wZJAsPr MNpE49L4MxUsRQpV+El7J9g21u03Gl0ptZn8hwDDEi7URVBkgHdOTmDDsFtcvjMz+5 zqbc9U6evu4n5i85gyQtU3wog0IJVQAoqTBllTL/2x+aW12WcLe0uDm+49dEAJpKyp 01opkbTIsBojoWy6t0XzKaWU0sPLKrDu7Bx2sGgZ7vTMvut9S69m/mNrUGSMdWCb+p IFu6uIeTHkdTnKxH0Oq6PXLjclzB8apsT0Z3Jb0M2Cl5dlrKG7D8iGBnun1mqIceQj DaSjTcXR4Vwng== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 11/16] Docs/ABI/damon: document per-scheme filter-passed bytes stat file Date: Mon, 6 Jan 2025 11:33:56 -0800 Message-Id: <20250106193401.109161-12-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D2B3A40003 X-Rspam-User: X-Stat-Signature: pp9cuh5s4kwx6116fqefinaoxcwijddj X-HE-Tag: 1736192061-64040 X-HE-Meta: U2FsdGVkX19LYWA/kIgf3uOkCuSUryY/u7ayXItFac1bLgNk/BNOd7jY+hzCahflxEwT6sTB2U3YkYmoW24hIIY8NqMJG6P+eC/CUX7THRLgu0CX+UUkvznQpPEpU7a5UHMf34u/9C8uQovsInJi/qqWVmcmNq8bB/fPdviMagaZ233tqEiO+CTkKmZOeksmnPpdTOnZgHhQMT3RLPD6ubg1TZg0yvDlaK2geoIwdDYL0AEzli/77UE7I41qBYIlG7hEra0zV/HNBsP82eRjxsfCXH7PMFQB/M1pd7CHZSIEw/5nKpXUajj351n8gDZqmnCPkcxLJXQ3ZoEHFXhfrYUdKjxhXxA06Of3e6DtGXKM876dXtEZs7sUeITd8vCmj5j6liCDEzj4h0VZkNjlx3JZodK1yLKCSPymPPNc1oAhLXg9jI22UFdp4KkEOCvUzuGYnWcqcoRt8nY1ki0QYtAIsM7+LGh5aGHeTECE8pG8YbbABUXWQ0GMFO0EYJDVOot+gHYmF1gq+QeipiTyhG4FpJCs/YDsMdXP/E9E7CdAvs5T/XFPAeH2uyVTymu8zhPSS5IPwjC1n4OZJqp2+7RcMbWgMxRS9QgwNZ6Ebxs91FhgsP9/U9xHG4F1bpVMUSwg8wmLPMxsoQ6EukqVpTn4zAALcvkuUWXt+UxglyzN+dNmL/QUZmRLCJ9WPAF1WNxRXA4eiV0y9YHCj36611SZEFwBmzdzRXoeLUDyeUzf01rVwqY4sJmXIVt74uGBRuYKyRcDQAv+YTu1naDgGdDEFjjOCRvQj2HXlaubkA/RoiI6jllJ3ma367yWr1gZryngMdgMLzloMe98VUHTS8RmkyWMoZXt2E3blmoVfo4D1ZVjI7/IApv3eAjToAC5XQD3lOS5quA+rqPt5yr3Jr3P9oBtqAsX/6uJvxR/TVL1eRGjIbfRa3yjTFxIWgCLG+C5uqaL5tOB9/+2xmG monPYWCC mSzLY+fFKhyIWfflZ61N/INRYkUgZFXuc0icoRCNBhF0gCQjNhrAG2yTTsbkremTT3bBpd7JhL5tMSHnKOA0dHWinDiYFiN0ESFJO9sgKIA0Ks1MSQP1uASV0XUWZKCYFtBC92ptrEV7adlR2KP/EuSchvJTKA2uYPqdMKCcaxQ9n8D6cwiPOGjnzMpRe3j/KXmDauapQvL5+nAT0YcgKGxyH/opEWiM5v1wtZWZxjEla+NS7e5FGgq4sdXNok2+7ARR9mFr8rFNfcKY= 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: Document the new ABI for per-scheme operations set layer-handled DAMOS filters passed bytes statistic on the ABI document. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index f1b90cf1249b..19cde386fd15 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -384,6 +384,12 @@ Contact: SeongJae Park Description: Reading this file returns the total size of regions that the action of the scheme has successfully applied in bytes. +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//stats/sz_ops_filter_passed +Date: Dec 2024 +Contact: SeongJae Park +Description: Reading this file returns the total size of memory that passed + DAMON operations layer-handled filters of the scheme in bytes. + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//stats/qt_exceeds Date: Mar 2022 Contact: SeongJae Park From patchwork Mon Jan 6 19:33:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927793 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 5377EE77199 for ; Mon, 6 Jan 2025 19:34:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CAB386B009B; Mon, 6 Jan 2025 14:34:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C33446B00AC; Mon, 6 Jan 2025 14:34:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFA576B00AD; Mon, 6 Jan 2025 14:34:26 -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 8BEB06B009B for ; Mon, 6 Jan 2025 14:34:26 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4EAE61A02BB for ; Mon, 6 Jan 2025 19:34:26 +0000 (UTC) X-FDA: 82978028532.10.0D0E6A0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id AF264C0010 for ; Mon, 6 Jan 2025 19:34:24 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="kmGp/YSK"; spf=pass (imf22.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=1736192064; 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=yXzMwO9hS5y61HDGqQ7DE3u52lWTcfpiQpo4Gtz53v4=; b=1E9THDYH8vVmclqnIi7pTLiTV/Rvc9JbeE4+olMwr7+syQWyEPsaFDV5AuyyRrSDmjIvmY fnChh/jgY3kQ5wJ2Mm7nxZaybzCKeOsWxkGFEUNerN+Bib2oam27M0/oGY/rHmnLCeNPdF 5a0DLwuFXILEWosGekuw0VWMQ8HCboc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="kmGp/YSK"; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192064; a=rsa-sha256; cv=none; b=tsGJUPyLXq+WGuOPEJ2+M8o1DrR2VnxJgI7b6uItAEMVHQBPvk7i9VUUsKvr/SEZ5p93i4 QPWNvfrjov5b7T2EkACA5w7d8FrHNr4l9gls3LQjljv8sRRCzWCjjGPcaWVmYg+hwdYgCr 6kUy1gpx032Z+e+pqpt+e4aNY7X8X+4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9BE5D5C483F; Mon, 6 Jan 2025 19:33:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44F67C4CEE1; Mon, 6 Jan 2025 19:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192063; bh=9gn2VJXpZEBUyQ5318wgjN/Yy6FG5EGU1q7w81srFoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kmGp/YSKlwkmxzXgv/o8J64JhES9W8mZpq1ly1q8cr951yRnCYYBc+G+O9OJo9Ntm ei/6x1XkBqsB7+53WDs/LFeYPYruqAXoFJS4uE0Gh1vNIkawCPg2i3/p5J3QgX5sf5 S4zc+/lU3kLflxuXyEviljbr5aGwT6nwZaGGEQ40outywIoBdGmToxaaIaOEXN0/O9 PVJE2m5KmRSwKw5n/VVqglh1OsVZcpoIv02xKb5etGU2G7ULwSSVDX6l4fQLj2Cnm3 KMHiaNt3n08C3+ZMUULxd1akv1pG4qpHs2SBQFb10qNzaNH/C5EJyFjIR59VMgiBub a/LKIHGFS6zXw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/16] mm/damon/core: pass per-region filter-passed bytes to damos_walk_control->walk_fn() Date: Mon, 6 Jan 2025 11:33:57 -0800 Message-Id: <20250106193401.109161-13-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: AF264C0010 X-Stat-Signature: q9j615dzpx4io8s9pdcijrfjhrorkoai X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736192064-142867 X-HE-Meta: U2FsdGVkX19vGzf5QCCuW7iw4EQwH2lhvXJf8hm9nPbgK7jd2pzUthQ6zsHQ52FUfx050ltJlHosL0uOXtue2K1HpEKlUK2Rd+aZrLT5CXBxVkuNzee9gW35oVoRGAAPSUZ137smoIsYoPyhbSAjRWV2tjuKsYe7/IUURkCd/9wBk0sHYjSHpnjw0MqsEAMeSggApJh9Bxx3dXmrBWOiy6iR+y3k/u9T5f4SXzQ3Us1Iw9A2sljPPOQKA2b8WFFBWm9Cepy+JtPbng9ggE47oUzTTzaGToDqdbpqPANm+u8k5CAD+imHrX3S1wOH/QEjy/che+LASbvj9jF+1/0ZP7hCcTZPFOHvVldO76soP5HhJOix3EJXYZpEFCeC8T5BTnRbCkZ10cm36Ss9CisB37yiiqGIpraOQ+ntwGUIDprN37PXA6UhR8JcFquXYNxmyRbr1Ei+JcxvqPy/RV+/W4j1Vmz7WT8Xog3l5W3auXMqmDK9KjG1uLtfj/z2qnoTA//41KnSPvwFxssucj07HiwfCRvGOj7s80FslxOfKM3rJGSiQyqMGkgUgqyaGuyI8WoYfcvxsILs131TDmeinzDag+WEiWBsdTmPlDa6piSwHaHa7GsPujBv8SDJRQ+jmaWpX6IldSpyGSXFHDAMYPX85Td4jNuohlvxZb5x8LVbigSpdcsfF0DcpXzk89AZ4wUmIUVewUa9IX6nEJS88AYGwr3NrZi0Veq2QeqiNYgvyZRgFtIDAyvFvN5bg09E+n8P4515e91SXoViLVR42n1+jn2/fA1iM9qs3V7U0LHfs7yGg1U8/iVigSkIywfEroH4kJYgaU7dPyLc9keqg26iqkSrDQL16xRb1Fb3Tvrs2U56/yjq5sodJvnBd/seV8+lYQR/ItCfdjZsu3QpahhqXsUP7ixRXkgpJ/NESBAbnZyYoqQv2K/kaXhP7KH5DODvPzPQkLlZtYaGhHI pS/d3uAd MXNgbveN9qH8c308Yn5feGqHXH9xzZfJ3+GS2V/HrDsC6Pui35gbD+GIbqHd8G8T8es8vjVEosfMl/vork2oPNoCImEVvE20xfsUXnvE8aV4nIbkNDU0KyJvfvBuRplKySVe//jKbiGC/IJrA86BToUFMEWdDpZ1C2AiJOfc+3cZtTTCC1GKK2T/ItIDJP4OMDbf4lySRRAPRn8zURS0UjTpSiIKrSZ4SFOMo0vTgxxx9u/s/ck5AcGerAmHNHJex0jHucXqt7VUzqovbJARwZD7P6A== 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: Total size of memory that passed DAMON operations set layer-handled DAMOS filters per scheme is provided to DAMON core API and ABI (sysfs interface) users. Having it per-region in non-accumulated way can provide it in finer granularity. Provide it to damos_walk() core API users, by passing the data to damos_walk_control->walk_fn(). Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 +- mm/damon/core.c | 7 ++++--- mm/damon/sysfs.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 2a93dbe06ecc..298b1a831e62 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -388,7 +388,7 @@ struct damos; struct damos_walk_control { void (*walk_fn)(void *data, struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, - struct damos *s); + struct damos *s, unsigned long sz_filter_passed); void *data; /* private: internal use only */ /* informs if the kdamond finished handling of the walk request */ diff --git a/mm/damon/core.c b/mm/damon/core.c index c4ce72a86d81..52e50f183ffe 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1445,7 +1445,8 @@ static bool damos_filter_out(struct damon_ctx *ctx, struct damon_target *t, * installed by damos_walk() and not yet uninstalled, invoke it. */ static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t, - struct damon_region *r, struct damos *s) + struct damon_region *r, struct damos *s, + unsigned long sz_filter_passed) { struct damos_walk_control *control; @@ -1454,7 +1455,7 @@ static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t, mutex_unlock(&ctx->walk_control_lock); if (!control) return; - control->walk_fn(control->data, ctx, t, r, s); + control->walk_fn(control->data, ctx, t, r, s, sz_filter_passed); } /* @@ -1574,7 +1575,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, sz_applied = c->ops.apply_scheme(c, t, r, s, &sz_ops_filter_passed); } - damos_walk_call_walk(c, t, r, s); + damos_walk_call_walk(c, t, r, s, sz_ops_filter_passed); ktime_get_coarse_ts64(&end); quota->total_charged_ns += timespec64_to_ns(&end) - timespec64_to_ns(&begin); diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index cf8fb5a963d6..224873ca8aa6 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1454,7 +1454,7 @@ struct damon_sysfs_schemes_walk_data { /* populate the region directory */ static void damon_sysfs_schemes_tried_regions_upd_one(void *data, struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, - struct damos *s) + struct damos *s, unsigned long sz_filter_passed) { struct damon_sysfs_schemes_walk_data *walk_data = data; struct damon_sysfs_kdamond *sysfs_kdamond = walk_data->sysfs_kdamond; From patchwork Mon Jan 6 19:33:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927794 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 02959E77188 for ; Mon, 6 Jan 2025 19:34:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD67E6B00AE; Mon, 6 Jan 2025 14:34:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A86BA6B00AF; Mon, 6 Jan 2025 14:34:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 900606B00B0; Mon, 6 Jan 2025 14:34:27 -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 7001A6B00AE for ; Mon, 6 Jan 2025 14:34:27 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 23B45A0215 for ; Mon, 6 Jan 2025 19:34:27 +0000 (UTC) X-FDA: 82978028574.29.269556F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id 89D93A0005 for ; Mon, 6 Jan 2025 19:34:25 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="mC/FZfn4"; spf=pass (imf15.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=1736192065; 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=6jrX9SAvLd7mLPZdcXDFI5AEiDmV+N2KOlUXoI8djAw=; b=jA9fckhyaFRffjkrq41lXu4O5mXqsR133CnRBZJk6y/K4gN6W4+DMlbxWK/3AhDWMX8Su4 mIYOPaqibwjHAAVo/lU5JBNF/0XMDzwE/57MZNtKICR2BPBNdqKNf6LCawdnkfmbuFMN2i YidHLn+jslEDxKYGpZbewlW0GZaSQwg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192065; a=rsa-sha256; cv=none; b=f5lfiT34bC3al3Jfsg7uYtoLrVK4SAjp45G03lf7aOfQsiIx774JSm01mKjxeT1OSuRhKa 7Ay423B1ti5WvTn/w+vYH88J0EG99VqYywei6fWLMzgPfFxqg1Tm52wRVOg/vBhD2dSTs1 xpoF2boiXlLVlhXwp4haN9HsEpWHGuI= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="mC/FZfn4"; spf=pass (imf15.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 B9DCE5C401D; Mon, 6 Jan 2025 19:33:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BC58C4CEDF; Mon, 6 Jan 2025 19:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192064; bh=+UnPb4bwnUVNPuDwxrpYf9x2zFG7e9vQ76jJhD49ioc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mC/FZfn4gnh9kGmSK6sjIH4jQ+kDiy0+R/V2rDZn+xwanzRwkdrnAeucKOZd1ufy+ h5+EjyLMVEdHz9KxNqreWlOB+2Zqiu53nN+pdSRacNHAZWZ+WdJYsWY7/3VP6A4NLe ooiY/3Qdfqc7Os+3HMWzWcXi4pADb61s/DN1tU7Ks0DJ5DcJs+I4LwdNwP0ZP7tPqB 4QdMm2jrGAkD9GFSNYWhwKZjaEmi0FpUpbJRDwgsbLtLpygprb5+iJL2+baV3JmqgX q/jIRQ0hwKVsuAwvI/Lhm6cJDVqESD1ra/fE6jBaolwGzQrhMjHm2ZjVwq7mv7tDCQ YIHG1bbNWD1UA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 13/16] mm/damon/sysfs-schemes: expose per-region filter-passed bytes Date: Mon, 6 Jan 2025 11:33:58 -0800 Message-Id: <20250106193401.109161-14-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 89D93A0005 X-Stat-Signature: w48t66xs14niob558wrm1n9fuhefdyzn X-Rspam-User: X-HE-Tag: 1736192065-424560 X-HE-Meta: U2FsdGVkX1/V2fmiz2QCsjB0jj3wHMLtMaRFnfPJJPDaggI3J4LI2b1dPoYKGT2pUi8+j9XGqp6WAGSL3eyWIst00qMKsOT7kd1PQgc31R+FPuj9dkS1+bzrGbf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diLMOS62xZZcD46LZm0hJ4n/UN/XNoUzRo4UHmgtc= 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: Per-region operations set-handled DAMOS filters passed memory size information is provided to only DAMON core API users. Further expose it to the user space by adding a new DAMON sysfs interface file under each scheme tried region directory. Signed-off-by: SeongJae Park --- mm/damon/sysfs-common.h | 2 +- mm/damon/sysfs-schemes.c | 19 ++++++++++++++++++- mm/damon/sysfs.c | 3 ++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/mm/damon/sysfs-common.h b/mm/damon/sysfs-common.h index b3f63bc658b7..70d84bdc9f5f 100644 --- a/mm/damon/sysfs-common.h +++ b/mm/damon/sysfs-common.h @@ -48,7 +48,7 @@ void damon_sysfs_schemes_update_stats( void damos_sysfs_populate_region_dir(struct damon_sysfs_schemes *sysfs_schemes, struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, struct damos *s, - bool total_bytes_only); + bool total_bytes_only, unsigned long sz_filter_passed); int damon_sysfs_schemes_clear_regions( struct damon_sysfs_schemes *sysfs_schemes); diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index b447c412b02c..deeaf23c1fcf 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -19,6 +19,7 @@ struct damon_sysfs_scheme_region { struct damon_addr_range ar; unsigned int nr_accesses; unsigned int age; + unsigned long sz_filter_passed; struct list_head list; }; @@ -74,6 +75,15 @@ static ssize_t age_show(struct kobject *kobj, struct kobj_attribute *attr, return sysfs_emit(buf, "%u\n", region->age); } +static ssize_t sz_filter_passed_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_scheme_region *region = container_of(kobj, + struct damon_sysfs_scheme_region, kobj); + + return sysfs_emit(buf, "%lu\n", region->sz_filter_passed); +} + static void damon_sysfs_scheme_region_release(struct kobject *kobj) { struct damon_sysfs_scheme_region *region = container_of(kobj, @@ -95,11 +105,15 @@ static struct kobj_attribute damon_sysfs_scheme_region_nr_accesses_attr = static struct kobj_attribute damon_sysfs_scheme_region_age_attr = __ATTR_RO_MODE(age, 0400); +static struct kobj_attribute damon_sysfs_scheme_region_sz_filter_passed_attr = + __ATTR_RO_MODE(sz_filter_passed, 0400); + static struct attribute *damon_sysfs_scheme_region_attrs[] = { &damon_sysfs_scheme_region_start_attr.attr, &damon_sysfs_scheme_region_end_attr.attr, &damon_sysfs_scheme_region_nr_accesses_attr.attr, &damon_sysfs_scheme_region_age_attr.attr, + &damon_sysfs_scheme_region_sz_filter_passed_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damon_sysfs_scheme_region); @@ -2105,12 +2119,14 @@ void damon_sysfs_schemes_update_stats( * @r: DAMON region to populate the directory for. * @s: Corresponding scheme. * @total_bytes_only: Whether the request is for bytes update only. + * @sz_filter_passed: Bytes of @r that passed filters of @s. * * Called from DAMOS walk callback while holding damon_sysfs_lock. */ void damos_sysfs_populate_region_dir(struct damon_sysfs_schemes *sysfs_schemes, struct damon_ctx *ctx, struct damon_target *t, - struct damon_region *r, struct damos *s, bool total_bytes_only) + struct damon_region *r, struct damos *s, bool total_bytes_only, + unsigned long sz_filter_passed) { struct damos *scheme; struct damon_sysfs_scheme_regions *sysfs_regions; @@ -2135,6 +2151,7 @@ void damos_sysfs_populate_region_dir(struct damon_sysfs_schemes *sysfs_schemes, region = damon_sysfs_scheme_region_alloc(r); if (!region) return; + region->sz_filter_passed = sz_filter_passed; list_add_tail(®ion->list, &sysfs_regions->regions_list); sysfs_regions->nr_regions++; if (kobject_init_and_add(®ion->kobj, diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 224873ca8aa6..deeab04d3b46 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1461,7 +1461,8 @@ static void damon_sysfs_schemes_tried_regions_upd_one(void *data, struct damon_c damos_sysfs_populate_region_dir( sysfs_kdamond->contexts->contexts_arr[0]->schemes, - ctx, t, r, s, walk_data->total_bytes_only); + ctx, t, r, s, walk_data->total_bytes_only, + sz_filter_passed); } static int damon_sysfs_update_schemes_tried_regions( From patchwork Mon Jan 6 19:33:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927795 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 1557BE77188 for ; Mon, 6 Jan 2025 19:34:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C37B96B00AF; Mon, 6 Jan 2025 14:34:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BBF1A6B00B0; Mon, 6 Jan 2025 14:34:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A60DF6B00B1; Mon, 6 Jan 2025 14:34:29 -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 7DC7D6B00AF for ; Mon, 6 Jan 2025 14:34:29 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2FF471C6244 for ; Mon, 6 Jan 2025 19:34:29 +0000 (UTC) X-FDA: 82978028658.04.3AC6B91 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id 9622A40008 for ; Mon, 6 Jan 2025 19:34:27 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="nSi/fpfL"; spf=pass (imf07.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192067; a=rsa-sha256; cv=none; b=AQkAE1K7KWRHxBmWk+YqPhJLHsbAUoPaRIktumgnihXMDN6BmxBs/P4FEMnkNi7nZKOvFe weRV9HykqCl4MFakaJbUcrlQxXMSLWv3UENc8RHs3zVwopvKY6gcaPRS1EfuxeTiby2qDW xfJlVmG8yzwoVWEFYGHuJRuuTlnkErk= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="nSi/fpfL"; spf=pass (imf07.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=1736192067; 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=ureGh8SpImpvgX4E1Ttr2TchV960XUwAx9BMWM497h0=; b=0//cuE4fycxHrkaz6rtW7WHjmtnyZsMqgydpfZh8KfeT+HeCCAxKef+OkoVANV9FRYupok hEJAFV6sfOLDOwylGupxi42ISaIlOwCrkSw48lQPHE7liPpL8gBagPfMtiGs4SmSioNqm9 8ZKCTgxaNU2svi27H7CN47OSChPZWms= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AE5245C4A70; Mon, 6 Jan 2025 19:33:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFD06C4CED6; Mon, 6 Jan 2025 19:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192066; bh=vW6sgxrPCYe3gm7HEu67s2ECdsRdNIOjt9YthRV3gts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nSi/fpfLF+PkFCUc0GISfaKpiQJLoKPWVjMxjwrUWCeRIbxILdekwhg/drq/J3Vz+ Q8+MAfNxnKhNuNu3maXG5njC1ga5wJDdFAHolfcH/8KkzHDxDMekYiRQ+MB0/hzPg1 hKVszz29Je2pD4msyS/4T8SNa+EvTGA0v7OLrwVvy8abtGAAK8ty0sEzUIaAA3WZ/0 hVqPsLsfB56EFK+xbrwD5UdC1M97bvq03j75y5R9ek/MMDH5Z26/RRteBVcoy1wzkj gjw9YdliZQIsVvqu6GrYIxIepbs3h0S6jjZ/7HvT9o+kAZbG+MXkTcQH+WN+3eUtPV pdVMCXhXBP00Q== 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 14/16] Docs/mm/damon/design: document per-region sz_filter_passed stat Date: Mon, 6 Jan 2025 11:33:59 -0800 Message-Id: <20250106193401.109161-15-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9622A40008 X-Stat-Signature: aoeh7wc14qrn4cawbtukr6imcu8cwi9z X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1736192067-41465 X-HE-Meta: U2FsdGVkX19SN8pkpN2MYcDBzad+bZ2mZfk3OqckKZ1mVcRG0mBRfaN3jFSPj0lcHAv5aEsJZAIDU+caSVzB6P9n/LAtgQvlfHDGInOaPi/FskAV8IVcAFgzS34pyhRHwvc9N2xBMsKTYB5IGN1Exbmhs355vaieynjRrlKKy1kwojb3OT48wCRkP86CDfyCcwOqC6q8UI6NMJtmnedVWU3nEFnly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S82u4BQW X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Update 'Regions Walking' sectioin of design document for the newly added per-region operations set handling DAMOS filters-passed bytes. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 68145972cb20..449eb33688c2 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -587,7 +587,8 @@ Regions Walking DAMOS feature allowing users access each region that a DAMOS action has just applied. Using this feature, DAMON :ref:`API ` allows users -access full properties of the regions including the access monitoring results. +access full properties of the regions including the access monitoring results +and amount of the region's internal memory that passed the DAMOS filters. :ref:`DAMON sysfs interface ` also allows users read the data via special :ref:`files `. From patchwork Mon Jan 6 19:34:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927796 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 8D96FE77199 for ; Mon, 6 Jan 2025 19:34:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5F6D6B00B0; Mon, 6 Jan 2025 14:34:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A12AF6B00B1; Mon, 6 Jan 2025 14:34:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B45B6B00B2; Mon, 6 Jan 2025 14:34:30 -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 5D4C26B00B0 for ; Mon, 6 Jan 2025 14:34:30 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 18883120271 for ; Mon, 6 Jan 2025 19:34:30 +0000 (UTC) X-FDA: 82978028700.17.AF3065A Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf25.hostedemail.com (Postfix) with ESMTP id 784DBA0003 for ; Mon, 6 Jan 2025 19:34:28 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sSnQVJsP; spf=pass (imf25.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=1736192068; a=rsa-sha256; cv=none; b=7uJIXNc+1ZHrzcZQ4qFNvNOKQ3jORlDKegHWD5HRgz7l3aYepRlNOThr1HVR2dsE3OazIH I9QO1mjNJlzxPkrBi7Y1OSD3Ggb4FwkXdBzdy1+lRzxHUpKqfhxQbZZlsfazJwSXwjP5cl 8vmKEA6IfG/CxO2k5Ixbo5Hpd6CGYaQ= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sSnQVJsP; spf=pass (imf25.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=1736192068; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=F8Dfa+n+N2YzLX7uwrbcGig6C0R8OBtLHua41I+NQDE=; b=getK+DHVdNmQHypVRnURsbuk6ddP2M8vIFEW/x85ZVZSyvHpSa/wBOH56sytbx5jqwSb69 aoHOdSTQZIHtStGNEroM501Ub4b4RYIZEp0RdonRHRdCTBoklbC7kZ2Pot0q0zqc1igmC2 yVOvv0xucDiAnhpjTu/MOZfsmoWI5ao= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 13FD6A41905; Mon, 6 Jan 2025 19:32:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E106C4CED2; Mon, 6 Jan 2025 19:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192067; bh=rTeP/RjcXjYoOv0J/uUnolt0hy96UnSrvDc4IrgaeA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSnQVJsPXoRIaYHCZbDfi+aHFFaxuVkhI/cB/qynYScRZkhs0we/TK9Sa2gbVyLd1 m8neYW8nQcKHUeUp87tJQQPUGSmRC2MjP5+2G2lvrbVC0zBsNIKUvwNYP/Nb3ihXJb AGldb5ldLQbnaZi5GkHBWD77Aj6FKNbLjnXiasCGBSqkpl87p/clR+DhJwXjp5IoOt vZC2kEFVX/2mko5lFX0G6NUI8TBu6XIIY6rqGYX7PZ4zmpdyvCr3hWth+vjag//tW/ 9Y6h9H57N1sMOu1tJjm1LnpEW4fYtIIWBDwP+yD5MfO7kuVEMxwSZJPTUNr4z/RlKI Nbl1XYrT0gxfw== 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 15/16] Docs/admin-guide/mm/damon/usage: document sz_filtered_out of scheme tried region directories Date: Mon, 6 Jan 2025 11:34:00 -0800 Message-Id: <20250106193401.109161-16-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 784DBA0003 X-Stat-Signature: t5f83zxhg9hixc7ucpaxycr1bp63hkcs X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1736192068-151693 X-HE-Meta: U2FsdGVkX1/871mg3sjcwP67dgb7ubdRhgpwNgeDedLA8+jvhwBPnrVFNlDpS2wBz3LHa1kV6KqnpfSa/yuOabTAU+2d05s5umhDSq57CwN6DVqn7FVJA42ntABQsyRtcun4tZLrC2nfTmd1BI2IN8WURmBmiCV9eLWMHhpzkThTCPNY3JRy+okDwbaz99/xA/G63tX7n4TK6FojXLOLkp4PBFbpc3IoGpEtMa4IQkRgrqD9sDRnfv4Cf43Z38Igc4uKfDqT+wVZSgCPcIQQFLdbH6K9p7me5ax3lW1/K3bi9jO/9ZEPzKbc4LqwAG+cqUap6s0ioJLmyNM+9B6mgwWzsfEnu1jd8yg13h57AKWEVBAFdBnbRvKTid/LeHA9WNM3HJyNabaFjvyhGa6KsI5UOt51Nzif/BhRdBfmhYaxLcEXVeVZo1Bus1/yXcsGJwu7tWKT25vFkTJzRWyEMjvr9CfiCBBmVeZqnYjWOuaShab2Wy8UVM+YI6VYb6Q741PlnddMucJEG9x2q/YrtwYoLESULz1rARaMSPPqcDjsWr2zwn02ei4kof1J1a7Vpkl64LzdIjh7WYfT/Y7kXt7ji04iqj9M+xxbZzcrhPokgQVh9RO1gejTRlyOLv+sMqcCIkK6dzmLmHXwEQ41gq/DX+w0GWA6CxVi76CmG/VqgMGc3jp9mnVF8JImlzWi+LzXdZQ+9vCHJuQY46fPoYh70myGakgUrFQ5tvSdyTgf0ai3/J/6prIrc3tP2DjxHs0QULPKLcKiBLAVdtxxg7yZRn9Nep38Oba6CWHVIuaWOEkonSRUuTCwN6jYChaPGf/h0okrtxD4EAV9L6MqDfMDbojHHPGZifYC0nHWDekqoHynbu214ueQcY5fSKoVqDlAF6gAgYvwYMkltg+yhPhehADcY/iI4G7S2Up4ro0J2un1KsMZEQ0Q/Pc7oqBVpHMpw0p1oTyfJkGJ01j C7+vs2BU Qc5VHqj9LMB3X3aouipQajiB9ULPm1qqjVkNSkZreQwnh4DbhvCrjEGRmQNpaGkSCUgQrJRYJ5S+aLUVXjAotLcEUJW2XJSKHXJQaJ/43LslkZYexCVh2fARGuwnn0BD1AgoOYeueDKu2O0lN+Zsxr0n0S1GztdXbOC443nOSBNxb5yYtMAjDawFf/AXnLoWQ+jvGh+LHwbO7qRl4+P6dkVShWusd/k8HkjH5wyF0KEn/jgqu45b+zGZqhwDaxZZvQDGxBMi2nm1yoETlDq5C342HtwnRMSO9AEKyIU+ayVIxlBLYePwU5HrXlw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000040, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Document the newly added DAMON sysfs interface file for per-scheme-tried region's bytes that passed the operations set handling DAMOS filters. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 95c174be9c06..71cf29ae8502 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -86,7 +86,7 @@ comma (","). │ │ │ │ │ │ │ │ 0/type,matching,memcg_id │ │ │ │ │ │ │ :ref:`stats `/nr_tried,sz_tried,nr_applied,sz_applied,sz_ops_filter_passed,qt_exceeds │ │ │ │ │ │ │ :ref:`tried_regions `/total_bytes - │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age + │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age,sz_filter_passed │ │ │ │ │ │ │ │ ... │ │ │ │ │ │ ... │ │ │ │ ... @@ -494,10 +494,10 @@ set the ``access pattern`` as their interested pattern that they want to query. tried_regions// ------------------ -In each region directory, you will find four files (``start``, ``end``, -``nr_accesses``, and ``age``). Reading the files will show the start and end -addresses, ``nr_accesses``, and ``age`` of the region that corresponding -DAMON-based operation scheme ``action`` has tried to be applied. +In each region directory, you will find five files (``start``, ``end``, +``nr_accesses``, ``age``, and ``sz_filter_passed``). Reading the files will +show the properties of the region that corresponding DAMON-based operation +scheme ``action`` has tried to be applied. Example ~~~~~~~ From patchwork Mon Jan 6 19:34:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927797 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 CC80CE77188 for ; Mon, 6 Jan 2025 19:34:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E5A406B00B1; Mon, 6 Jan 2025 14:34:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DE1F56B00B2; Mon, 6 Jan 2025 14:34:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5B966B00B3; Mon, 6 Jan 2025 14:34:31 -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 9F4086B00B1 for ; Mon, 6 Jan 2025 14:34:31 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 24B681602A4 for ; Mon, 6 Jan 2025 19:34:31 +0000 (UTC) X-FDA: 82978028742.17.36FB273 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf11.hostedemail.com (Postfix) with ESMTP id 874D840007 for ; Mon, 6 Jan 2025 19:34:29 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HZHzEXT0; spf=pass (imf11.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=1736192069; 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=vvr2qABIzHiFKBWJgAYDA0yAaS8oSG6526R0C9e+Uxc=; b=EiLCFrQ2XunTcW/Prs1aB8RlMoTDzCSCsjtMBOF/8Ae9Wd0MwCiKoiu9CG4FP2bU6JibX9 KavHVKyKMUk1RDZlGJsB1BT11vwPOyXim90EfFgy9w5AvuVU2X+P8r2woSbtor7+0iq9nl Zdx0eng2yAImhd6PJ2wuQ4873WXpeZY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736192069; a=rsa-sha256; cv=none; b=v+cFUBj7TEpikX/qGwHMgld0FOB4wBU9iK/LbmJWiQ0nc8zQGMWdcXkvOLP/ldwT71V76h UsiUES/I1Olha7QRPJvCLGGYYxUkC1vyZgRGgwcxMXqvlzLMDUFOWffPHTgFUTvdkITfmc oOtneH//B/y8QgqU9FRUbbN8oXCruxg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HZHzEXT0; spf=pass (imf11.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 26EDBA41D92; Mon, 6 Jan 2025 19:32:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F7EAC4CEDF; Mon, 6 Jan 2025 19:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192068; bh=3O+7JbZj6xxSI8uZRXk/Ms1BG1Ir2OifGM6jxU273yY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HZHzEXT0/ZCiiBJtIoztxLXOeM5gJiISJG5r6HbQyZrpw/1mVfjWVBtuPg0ERW5kJ 0h7DbOBlSt5hqBB4g5tr4gLDyKEftf9mZ9NXCo4Ca+oEwNHrgoiSDm/+DRLUb7tqA1 lOgCmypgaOYcSvmrx4t/cyk0zXA3YiNYBUqijWImfhYnvGebhzu8LswTHl2DNPqsQx PVMU3LIIFBul1jXu7clmKpHV8dJ91/1b5MIP5Is8PLMkNovAdI3pmGGIz0Xf7W7CQw 0RIHE6StYflDhilR+J4DNRyNW9jFMQD4eq9ZUYCr+Ls9o9bXqxrQYhMBcyDKcSPkUm tXB7fgnNMzRMw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 16/16] Docs/ABI/damon: document per-region DAMOS filter-passed bytes stat file Date: Mon, 6 Jan 2025 11:34:01 -0800 Message-Id: <20250106193401.109161-17-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 874D840007 X-Stat-Signature: tunwfxicnrf9nxrc8bjrppm7ik8pq8q6 X-Rspam-User: X-HE-Tag: 1736192069-398619 X-HE-Meta: U2FsdGVkX1+2/8rEalD0WY0uJ86cfgFNhQHlCMKdGj0dh3qmvGqhlWO/pGRg1q9FyorvG1Q6YsTrCHqz1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XRTgsIbtG6bo7YpHIO/Z4ewdu8wJ7Ga19s9kudyrrPBohHgPvSDmQ5XYKUQgl5i4C9LVSG8mfOA= 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: Document the new ABI for per-region operations set layer-handled DAMOS filters passed bytes statistic. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index 19cde386fd15..8c0acb31638b 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -430,3 +430,10 @@ Contact: SeongJae Park Description: Reading this file returns the 'age' of a memory region that corresponding DAMON-based Operation Scheme's action has tried to be applied. + +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//tried_regions//sz_filter_passed +Date: Dec 2024 +Contact: SeongJae Park +Description: Reading this file returns the size of the memory in the region + that passed DAMON operations layer-handled filters of the + scheme in bytes.