From patchwork Thu Jan 9 17:51:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933070 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 904A9E77197 for ; Thu, 9 Jan 2025 17:51:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F2356B0098; Thu, 9 Jan 2025 12:51:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1609B6B00B4; Thu, 9 Jan 2025 12:51:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFECC6B00B3; Thu, 9 Jan 2025 12:51:41 -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 149A66B0098 for ; Thu, 9 Jan 2025 12:51:41 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id CF7DE42EFF for ; Thu, 9 Jan 2025 17:51:40 +0000 (UTC) X-FDA: 82988655960.04.85379F4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf08.hostedemail.com (Postfix) with ESMTP id 37027160016 for ; Thu, 9 Jan 2025 17:51:39 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GtXAjCKQ; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf08.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=1736445099; a=rsa-sha256; cv=none; b=fRTAPstExvi09eG694BCN1Ov8wuNCLmu4h6XHOagdFvxtfixnGjGkNlpMzawTb3IlCa2wD j4uD3wwMZkeULspw/bBQl5cLT1Fhjam8V5Ue5pBE1JuLfzQ56cEPF0eFrtyiSpxprKoG+3 x2dH7Pcb6lfsXYL+u7hw0D9VWjOJqic= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GtXAjCKQ; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf08.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=1736445099; 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=d5J1AIHTYlUmXrjLKn82T8Uz9hRFE/DgF4ayh9KaOgg=; b=Uw3AM1tT/g7I6bTdkP3LaXOyLUbFRVQ/xvJleZy+f3o0uH6JLrxSRkNgwrh1Ox7NOOjPu4 xa0QKtQI9jhVAyzo1QsVJ9co2E/cvyWDxRx+2kp5U0BRMHjVt3ulIDfRjhxWkcuebL83v3 oA5w5Mha4l+I0FxxNd+RxI8rAEP/EL8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 621205C5CB2; Thu, 9 Jan 2025 17:50:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA5C4C4CED2; Thu, 9 Jan 2025 17:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445098; bh=97I76lDfvaM6L2LOAAduyShBBxqQhcZ1zQRaRPWTvuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GtXAjCKQhCXp6XoAzncBThz0kaOtImaAYZIh+2dMqtJca447B2ZLB0/KZW9C6EKwS tYgd4e8PzXMPQGuimjfE7awNMh+Ue58ZeG57xpCMyQgj9Kh6gXR0BDVBNTM+LDjBFS OJ35/YSQ2AYXSlV3kWJR6NeKTsjBABupqrMIQsf/CwT6x18zy1VHzoGdBwsgROPym0 2R9PoraJyf6PAvJ/fNbTJZWwcPTNCvN5Fjwgjd9xtJqZEuWf+ZvW+2KraUaTUJ64Jq 9gPoaPMLqUjH8wQRWwXOkbxtVjv2PVIlw/VdcOMaAiAePHI8bcvYQANhWKCjBlHa20 xnlIkeVQIiekg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 01/10] mm/damon: fixup damos_filter kernel-doc Date: Thu, 9 Jan 2025 09:51:17 -0800 Message-Id: <20250109175126.57878-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 37027160016 X-Stat-Signature: mtkqz6nh7smorp4759wgt5er1g5n89xb X-Rspam-User: X-HE-Tag: 1736445099-208428 X-HE-Meta: U2FsdGVkX18EXYVsj5zzWUk2TPKJ7GdXCfRkejwc7z3XsZt22UlLRAFIUiUvMee5fez0zFNsg4/5/aIHVLAe/9NRNqSRfw57PcIMxiY3NLQ02+pPfHUhH4gSLggcKUoqUe+04Yc3ek6ooZfCr+2u38F2x+ArBgCHS3tRZhxfvl4OpuD89/VVfQ2rp2wjGaRKHFP/5xU9/7Nw/Y99nJpzKw8fhYx88wquBmXUjT1qiT2MM2gGGOb2j0Ks9SqC0hlgmgIjsKYwYXICPKTyjLXPf3NxSGsReNgqI+21974btvjtz2wWbsMqRrPisxydEJGpea+8+8XqLda3qpzw3OjUDu9M1uR7yLzSIaRqTaxZdEe1yrsKZn2AqLlOcqQmPt1PTAejurF4WUWcPKm4kR4XJq5utGTYWXPw1/5IpRK24z745i4e8InDjgl8Q83LJfbKnjoR+DjpekgCgfvSl3VJo50vdK2ORDAyqfgY5s5s9X+jM4jM79wniglJp7n6U9KGD7ZwWeq1GwIQWWKKIo+GpDnQqs/N3WByPN+NFEGwh5hd5x/A57aNiVjryXGKhc3PeALeVbpfgyr+AAuWtXpGDnW3wYXHxVAJ+FjsevsnJHb63PzQg3hrLYElvgIxVKR0W2ODy9LnpE1LHqvNGf+ukIIYiXnoX+vkgObzxJOSU8ATIzvuC5BccKQ4zwel9jVhrFZc8QnXUDf4BfI1vTskYnbL7hICpuvvNkW2dRFS6dzR5NF/P/6iruDsK7EpZ6n1NxiRJQXVGhoylQne58B8ae3zvRaxbSR5CYbW0pT+7vvbW66Sg618Rf0T1TVcQ6BVxeSVoh3tUMngr42VJmvuGl+WrPEIvHF3ZfAwrGtoqT16PJy2kUNfr9VloEViEQH2xt+4qID+FtUeb+mLBHyIXm87wpQP9ZjeQbpB7JtQ+2tgNYluA2d/YwVpVl4vmzjRqLzCdaVW8fishepSMx4 8Imxx3nK cm2mWmKkqQrmH2D6fQ3w2l5q0w8TZtNijUkFpAnl8fiI3g30cOsQilHZb/f3SowwjP/sNoWxmJXDJVaYSV7KYccHrVxFySFJ+lSpDjtu96/B3XL4Kr0qQkJWkdKzp1L25s2nBsdo7loTaBLwRBI65bpLHXs4kLwshpOV7nQzwo4GmUFKDk2MCM8EgfhMrSTcSs3LHKIavo3njhnaJ+hKMpYLuSzFalTR1t+wuHneU6a8jGwR7M2Wy6XnRfmmKtt0C9d85xG4hzrj3Z/MBLGMz6BSPgD7SnzJswMLVPHqPv8d/99NhtK8p8fGhmOs84XgsHcg+6UsBC3tdZVf/WNquNrH+4XY+XMthDIl6 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: The comment is slightly wrong. DAMOS filters are not only for pages, but general bytes of memory. Also the description of 'matching' is bit confusing, since DAMOS filters do only filtering out. Update the comments to be less confusing. Signed-off-by: SeongJae Park --- include/linux/damon.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 298b1a831e62..72afba74ac6d 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -347,8 +347,8 @@ enum damos_filter_type { /** * struct damos_filter - DAMOS action target memory filter. - * @type: Type of the page. - * @matching: If the matching page should filtered out or in. + * @type: Type of the target memory. + * @matching: If the @type-matching memory should be filtered out. * @memcg_id: Memcg id of the question if @type is DAMOS_FILTER_MEMCG. * @addr_range: Address range if @type is DAMOS_FILTER_TYPE_ADDR. * @target_idx: Index of the &struct damon_target of @@ -357,9 +357,10 @@ enum damos_filter_type { * @list: List head for siblings. * * Before applying the &damos->action to a memory region, DAMOS checks if each - * page of the region matches to this and avoid applying the action if so. - * Support of each filter type depends on the running &struct damon_operations - * and the type. Refer to &enum damos_filter_type for more detai. + * byte of the region matches to this given condition and avoid applying the + * action if so. Support of each filter type depends on the running &struct + * damon_operations and the type. Refer to &enum damos_filter_type for more + * details. */ struct damos_filter { enum damos_filter_type type; From patchwork Thu Jan 9 17:51:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933071 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 DC694E77199 for ; Thu, 9 Jan 2025 17:51:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 859EC6B009E; Thu, 9 Jan 2025 12:51:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 808DF6B00B3; Thu, 9 Jan 2025 12:51:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6835C6B00B4; Thu, 9 Jan 2025 12:51:42 -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 0B2216B009E for ; Thu, 9 Jan 2025 12:51:42 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BADE01202FE for ; Thu, 9 Jan 2025 17:51:41 +0000 (UTC) X-FDA: 82988656002.15.0008F06 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf21.hostedemail.com (Postfix) with ESMTP id 2722B1C0004 for ; Thu, 9 Jan 2025 17:51:39 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XgDCg4aO; spf=pass (imf21.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=1736445100; 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=DBymLb+DgrbeQ3sQckQBM7U131cEU/hAsc/00D6k+2c=; b=wGyOVH9gmM1rMDNWSlr2QKPJWtJRXPnt9lE+mUX1JAqmqqAWiv1dz5C5UOJGx9C3RCPTAo jJWM8YqQR7TU/7fRTJ3lUgD+8AZk8Mq8aGVa5Az34A1EHJKs9XgMUYRRxilsUxsmxe1wkb ZZAyPjjvFgtdT7sMiORKgcC0DzvX+2A= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XgDCg4aO; spf=pass (imf21.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=1736445100; a=rsa-sha256; cv=none; b=unjA02NPb2rGKqSaVpgAsHJ4G5v9Wqw0U+4WTrOestPsKGi2843pXVRFhHTf3flRq1H9dP WxpCpGGfnuStaF50cHGzhQcK2mGM7o+3eBSB6DMZy7KFJ0C6QZRVLSO1ZlllkEDa5X7Rpa BfbWO1x/Oovd0+XXYSbOGhzMerDdyoo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7C0215C5CB9; Thu, 9 Jan 2025 17:50:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CACFC4CEDF; Thu, 9 Jan 2025 17:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445099; bh=b5/TGNrGU2BJ6e8ROpk/K/qKcaZatsIxBg3oBg+1uiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgDCg4aOnSyKMLbHEiFCUeQulqorcmktJn7pvdk+KyGJPAAKYP3hw5WnF080ziHBY Cux41jLyFii6G1U+3tgU+voGlXx4KWqRYLpSEYExW+CVkQ5SSj6y4Gtr1m7oetsPxb AVNfrzOLWnPEEr9//e9rt1WVoUECGgS1L8P+J/xt47QJXSWgPcrvFeJI8DfJfH2hmR 6OlI1rFGwVWfYml11NanvbR6xZPOyAN/n2KEUDZ2YDkVbokqLZ/Fq/jNdbxNXtbfja dawTjerZ+LQVrDupRPjQRich0DOoWSQpmaea/jAlBS+ZKRUfGvgAX1JVimbYIXerqU I1Ol6vWUob6Fw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 02/10] mm/damon/core: add damos_filter->allow field Date: Thu, 9 Jan 2025 09:51:18 -0800 Message-Id: <20250109175126.57878-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Stat-Signature: akxbdke4zxtpx4wgaaw9i4zbxn3nobgu X-Rspamd-Queue-Id: 2722B1C0004 X-Rspam-User: X-HE-Tag: 1736445099-224148 X-HE-Meta: U2FsdGVkX19vA/0Qz7jqgWRiPIF+0ZK3ZUhEQmCv4TX2BrwTJENGuGEQ18pOk8KYCZGgD9S4yDiYV5kO5iFSUHM6Qzdpj8j5xvsHDv2jz8lHGgUb1i2hcm2s9NXS0QdA1BI6f4nZ4/9fEa2YYKvIAFiM1balzbJFmX9wcCX5xanXatJ0uMsiSQ4w3eRL5pxyXUpDv10ptmB5FcF8BEt1l32VAogyqr3t7nITJqy1imHnjzhqixfui6NcbLS14wG1NJ8ylFZZL5LBjnYZgeQVJSLfY2q1JJx2PHKnGqVr8Nu0hym99EIKK+S1YuMANw9HZdaZAt0ayaejIbyhzBH+GYJMgGJNdY463xaskqNoVPWeyNuanJCVez+4X5mvGN1RckIBVHZt/ZVnXp3ujdZfz4A/m1PVGLlAH88J2wXi7l7MH59zKFWmPEypKmOp6FXUkJA+1oBEib+MCHjoartELIBmHw293R+kSeyEWDRWthmcSfOSyblUg5nQtspjI1fvCLmGdOLiureAfvouVUz2m/9JaCWPDg24A4WPZkyVgHITkZ4LEPqlHpEOlKxj8VNFFjIMNCV8/5QEKzv/NodKVcbVa3GRbC5LG8bzioIOEkLBpsWMO2bK6UVO5niPnYwqI2GRWjBedsMD5/4LZckOgMNRI+3Qp4R+Y5QW+/Tmkwvv/hyAV0bADlXd4ysa9qag0zE53bNz1Hqqeqzth0A3xMCLYVbwhCs7237wdcN1McBPw6sc8592MDz+K03QWN3LKi2P2f1yEn0MaErfGb1tuil4QqDLJZujDf+VzRc15cAOEiiI3tvQXlyagHQNXrDxoaPU/Ir3n9fxFnqZAUcdH1+1e31cYGkWSmF8NmpUcKjT7nlglWCud+OYeL2b0vAmTPqxJW8e1ESzuMpnsyO9f3/8zInSXYsqnfh5KZKMWkAxRv1weAdaXH04HbOpFgVjFLymIz+fdf0ZlazkfL/ vpj4E44C WIbE/DC0Sf6FN/MLUaUc7NckO+63IJfyqyHJLCCgej/kfYxr3LJYgMAU5vMqN0pjLqeeNwpwTJlbTvy8UnBT0AZaEeB7GWrwr55aUG8CocT7Yn2bBcYXdC4txwfGowSttCtkyR0FwTNpG6hp1gw4+lAL9m9nWdbDXG/GULzs3CAvDMfvb12RS2tLjOKgLf3kzsjAi+UViS6v9xuPkrYeG+1yNNEgNZYJ2umVs7QNSknYdWczm9Zu3hSA8jeNfP1y3c4X7byHS+LHgjwpCSOunhPQqZg== 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 filters work as only exclusive (reject) filters. This makes it easy to be confused, and restrictive at combining multiple filters for covering various types of memory. Add a field named 'allow' to damos_filter. The field will be used to indicate whether the filter should work for inclusion or exclusion. To keep the old behavior, set it as 'false' (work as exclusive filter) by default, from damos_new_filter(). Following two commits will make the core and operations set layers, which handles damos_filter objects, respect the field, respectively. Signed-off-by: SeongJae Park --- include/linux/damon.h | 4 +++- mm/damon/core.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 72afba74ac6d..8a2d104df5a3 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -348,7 +348,8 @@ enum damos_filter_type { /** * struct damos_filter - DAMOS action target memory filter. * @type: Type of the target memory. - * @matching: If the @type-matching memory should be filtered out. + * @matching: Whether this is for @type-matching memory. + * @allow: Whether to include or exclude the @matching memory. * @memcg_id: Memcg id of the question if @type is DAMOS_FILTER_MEMCG. * @addr_range: Address range if @type is DAMOS_FILTER_TYPE_ADDR. * @target_idx: Index of the &struct damon_target of @@ -365,6 +366,7 @@ enum damos_filter_type { struct damos_filter { enum damos_filter_type type; bool matching; + bool allow; union { unsigned short memcg_id; struct damon_addr_range addr_range; diff --git a/mm/damon/core.c b/mm/damon/core.c index 52e50f183ffe..bdde532ebbc8 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -275,6 +275,7 @@ struct damos_filter *damos_new_filter(enum damos_filter_type type, return NULL; filter->type = type; filter->matching = matching; + filter->allow = false; INIT_LIST_HEAD(&filter->list); return filter; } From patchwork Thu Jan 9 17:51:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933073 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 CB7FCE77197 for ; Thu, 9 Jan 2025 17:51:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C07066B00B4; Thu, 9 Jan 2025 12:51:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B8D356B00B6; Thu, 9 Jan 2025 12:51:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E08E6B00B7; Thu, 9 Jan 2025 12:51:43 -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 7C1886B00B4 for ; Thu, 9 Jan 2025 12:51:43 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 39273120318 for ; Thu, 9 Jan 2025 17:51:43 +0000 (UTC) X-FDA: 82988656086.06.E1BE464 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 7B28D14000A for ; Thu, 9 Jan 2025 17:51:41 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iOiV8xN+; spf=pass (imf09.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=1736445101; 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=ix4rX2LHLJWRMEMlitpt30LZfXj379qN39OYlUVwprs=; b=fJdczfBLh2k61j326/w+OmM77Kad/is0sVADBmc4HfAd2cCW95SMGxFGyVl+ILfgl0v722 yvOBpcr8GR2HwMgseaJTosqfSW0QZkQmVmlK7xGGUgHuJ/9kYNMnAXHi08eQWrqbgAv5FA 4fgkB5+xQkyXniTVZawqlZuBzvF7DEY= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iOiV8xN+; spf=pass (imf09.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=1736445101; a=rsa-sha256; cv=none; b=23MOjJPetX2EI39ABUDmRZEpSmTQbwmaFWzDH6ELDMTik9uXTYD/GYKAng1BEafTVpu2cX I/zhDDVgXmCSsdAxfRYdHbyU3p1KrSRZfr8yOj7AZtQLUul1C06jI2sRS+22ntLkzghBDD CAU6AJicVlwaOY+HV2O+Ps3qF4PkSao= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 89A4A5C5CCC; Thu, 9 Jan 2025 17:50:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36EFEC4CEE1; Thu, 9 Jan 2025 17:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445100; bh=/TwzvHzsYhMLVRMAly61w18SuFtGS0e8DIve8swoAg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iOiV8xN+tOzd6OhWGwRDcbApXOwx2OoSQwcl1ajO5uMihuqIeFetDPj9kO1jvRZI3 DCaVH7i0rTdMfXF9gctFxlGeo8ihHqNWZs0nADBR6YSrMd36r0n6p36YB1MuIFuRj1 /BMQS++22T1gOsjeEneFIB8/06l2tUcaCx5/BajT7ICW4t09cZsy+uQeu0Qyvjz7dx f8LNV/bZ+JLSt8fXU5hvrmJCT+A44RSIA0A4g8SuUGaxAAUCZaDwk07W+nPkt1v+gB qK+y9hp3bWU2vsD48OucJ/zTxW2Lmn30O1QwshQ0saR9Kd3SnNh47BIjxCa+9Mev5e F095E2SrYdR5A== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 03/10] mm/damon/core: support damos_filter->allow Date: Thu, 9 Jan 2025 09:51:19 -0800 Message-Id: <20250109175126.57878-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7B28D14000A X-Stat-Signature: hd7s4ad7ubwaok491uzj4mwxzrosycs4 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736445101-229565 X-HE-Meta: U2FsdGVkX1/LTLoPswhapI8wguubQUzsGEDYQxeWB/oQB4rLSamQH2G3hnlrSyvVTB8TH0ENL/95998c4ax+5RagMWVobBRJbqZarwOJ8pFLSYKKjgyNSMuIIQfd4AO3X5W8vkGfeNpq0Z3RBQiUikTLfoSZkwwr4qdAhdz9kKSA0dMPIHJjXXNho6uVh54+2IgovYL9bvT0lI+2KjPpgW4M4B+9MdsKhrMpGH4JR2O2/jHLubf0dGyWQXCeTGf2L832MCQqKgXstpOHRA+QeAxJ2wdBQWK4SvoIYPJNi5HOwaSMbx9g4M5htI25GU1o58nY+QYcIPJmt+PIM3U8DbuNLgjyxmhiwP5RpzAKUVDH/pYT7zcEkKwEBs2WHS+xu/gbYGKW3plhqclcnugq8CIiXkJt11AEuTQ1vTWur2tJeYkv//fmKyi8WsS5LPIHxrBCAMWRgVgRG0lc7dk8NWJ9LfHO9rqWfJtj/rRZPfs8F1e7a2dCWhfLEzsW0nUqdo4CerN58+LkiVQnRIJJriV0sy29t1984cTBUDCDgNGLfO4ZL0wAnq6QQxhYYDSCTzpb1csXadbIVdCIS5bdNsVOaX10JbyzsbiJuhICVEu3vgBJVSp4y89QREbjMnd60IpFrntpMRzUkYSCOgOKoHeviHdHUXTp5Ksuhgom6AVmINuydpt+lTKjtBHo8ZaTN6eQvciIT9pHIYJppfoAMHX0AoCn7ijPOu5i5mP17+PFp67Mp++ChLbxqCTfz6qO2+euJr6PaLI9MeW7tRomE+/GkbXtGK7DxQ/qZ6xsBxr1tRteAt8z21rUavPDZ2OecRu6r4HHuXmmjHI13MTdFw5f16IDJiRjwigARa6BgtGxR9dOJ0LfYbuQT1StBWpCBMLxcxPMoI8giJhNwGrn7WQEdy8Dait4q0z/6SaCWy2vSnGvQJeY6Jl++TSLYnkVF5A39fTwoB0kv34Wubj 62HvH16P D1H4rdJwC1EfZ1xMIXroH8w3OPN5Le/y0+MP4dfOX98c1KQmgsRurzBLTVBLzKj9e+KfV9IBhaYpSf2fZB0uBKmh/WN1ft8W9YweHNiWyk8UCMgQH6y4OIx4j7sDd8rGzt5bdziNW66t5YzqGRAaMC01hM1kpjKNyyy6Hd7DjJ2hpg+VLtsC9w+5C3z5knFN1o3UjCwsI0+aMZ/y4JyO4/aQV+Z0hihEr7my/ijY4PR/RSA7FTnwSiIgsr/eYKqzgL36yyHnIDBrZ/azeNkYnJNx45w== 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 filters supports allowing behavior, but the core layer's DAMOS filters handling logic still assumes only rejecting (filtering-out) behavior. Update the logic to aware of and respect the behavioral decision by reading damos_filter->allow when making the decision to exclude a region or not. Signed-off-by: SeongJae Park --- mm/damon/core.c | 6 +++--- mm/damon/tests/core-kunit.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index bdde532ebbc8..76707b0635d6 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1374,7 +1374,7 @@ static void damos_update_stat(struct damos *s, s->stat.sz_ops_filter_passed += sz_ops_filter_passed; } -static bool __damos_filter_out(struct damon_ctx *ctx, struct damon_target *t, +static bool damos_filter_match(struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, struct damos_filter *filter) { bool matched = false; @@ -1428,8 +1428,8 @@ static bool damos_filter_out(struct damon_ctx *ctx, struct damon_target *t, struct damos_filter *filter; damos_for_each_filter(filter, s) { - if (__damos_filter_out(ctx, t, r, filter)) - return true; + if (damos_filter_match(ctx, t, r, filter)) + return !filter->allow; } return false; } diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index cf22e09a3507..8f58d3424c21 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -434,25 +434,25 @@ static void damos_test_filter_out(struct kunit *test) damon_add_region(r, t); /* region in the range */ - KUNIT_EXPECT_TRUE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_TRUE(test, damos_filter_match(NULL, t, r, f)); KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1); /* region before the range */ r->ar.start = DAMON_MIN_REGION * 1; r->ar.end = DAMON_MIN_REGION * 2; - KUNIT_EXPECT_FALSE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_FALSE(test, damos_filter_match(NULL, t, r, f)); KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1); /* region after the range */ r->ar.start = DAMON_MIN_REGION * 6; r->ar.end = DAMON_MIN_REGION * 8; - KUNIT_EXPECT_FALSE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_FALSE(test, damos_filter_match(NULL, t, r, f)); KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1); /* region started before the range */ r->ar.start = DAMON_MIN_REGION * 1; r->ar.end = DAMON_MIN_REGION * 4; - KUNIT_EXPECT_FALSE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_FALSE(test, damos_filter_match(NULL, t, r, f)); /* filter should have split the region */ KUNIT_EXPECT_EQ(test, r->ar.start, DAMON_MIN_REGION * 1); KUNIT_EXPECT_EQ(test, r->ar.end, DAMON_MIN_REGION * 2); @@ -465,7 +465,7 @@ static void damos_test_filter_out(struct kunit *test) /* region started in the range */ r->ar.start = DAMON_MIN_REGION * 2; r->ar.end = DAMON_MIN_REGION * 8; - KUNIT_EXPECT_TRUE(test, __damos_filter_out(NULL, t, r, f)); + KUNIT_EXPECT_TRUE(test, damos_filter_match(NULL, t, r, f)); /* filter should have split the region */ KUNIT_EXPECT_EQ(test, r->ar.start, DAMON_MIN_REGION * 2); KUNIT_EXPECT_EQ(test, r->ar.end, DAMON_MIN_REGION * 6); From patchwork Thu Jan 9 17:51:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933077 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 DC8B9E77197 for ; Thu, 9 Jan 2025 17:52:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EEBAC6B00BB; Thu, 9 Jan 2025 12:51:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DFFB56B00BD; Thu, 9 Jan 2025 12:51:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C02886B00BC; Thu, 9 Jan 2025 12:51:49 -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 4D4906B00BA for ; Thu, 9 Jan 2025 12:51:49 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id EEE7E1C6012 for ; Thu, 9 Jan 2025 17:51:43 +0000 (UTC) X-FDA: 82988656086.27.10215FF Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf29.hostedemail.com (Postfix) with ESMTP id 6CCFE120011 for ; Thu, 9 Jan 2025 17:51:42 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=h2nx70CS; spf=pass (imf29.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=1736445102; 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=ppnXHYuRyCO9ER6Am0pnaomaifGzFLjVn3gXqBXeWP8=; b=VBFG7pjgrs7HnDhj11DctClmKyhXUX8H8O35Ea7tl6Kr84kR130uARmP88ej8up+SMowEN +juV1yua7f0niVv+LsVk06/5pnS/gbXdfElW6WND0U1JM7/i1nXtwuv5mW+6WxAsCx2vyW F3nBXovO4zBuhUbTEA5hCx+YAfQ3idI= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=h2nx70CS; spf=pass (imf29.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=1736445102; a=rsa-sha256; cv=none; b=eJI8b0SXKq/oBCa3iE8xJRi0Oqoqd1G6UM2y9PosccJ3KK6OjWGwTZcRVgFyKghzBHlsyt JdlZyqrLOfI3sKeI+FdKXrRDm34/++aSzB6r2r7pBVIcYZxXVBO6BoQHm+g2R68Zwxwtj+ 597itiei+/CpmqYZsyJmXIiLRPhPQ3E= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 3ED76A42528; Thu, 9 Jan 2025 17:49:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 474E2C4CEE8; Thu, 9 Jan 2025 17:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445101; bh=xBH0b3NhxWYTGElmoBJalgG8ZkJmFacZfKWdD6zTD8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2nx70CSAa1D7NJ1Q+cniSmR/Cs12oa2tSDvv2hG1MrjskAGMUls70M8xr21kMENF 4q4oBrSWzKZkaACyQRBmq70GxYNaZdA47qMw1vGxo9rt4Ku8cfzxiOPHsEeIv59ZDc qXLs7xqDVw10ku1W8NLXWOJFEuLyF8FurvEfdJQ2kqTKgcoAmTBMQu22kmd3nO+zGe YbRgznO0p4Z79IkRv+Kyf8TKpyp1Sk4G9VItMY+3WB36l/+AelHeX8q2MaiNKkSGZj WjQfKQVn8KHfHrpm2FrFCHte+if9KtE0kky8UjLhkiXN9kqr13ZOl5S4S4XU9jvfFa p889H/fWOEIlQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 04/10] mm/damon/paddr: support damos_filter->allow Date: Thu, 9 Jan 2025 09:51:20 -0800 Message-Id: <20250109175126.57878-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 6CCFE120011 X-Stat-Signature: ck7sxshfu8ifi619ut9y6hhb63eaapgi X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736445102-167899 X-HE-Meta: U2FsdGVkX18LLtpyDeBbMO9Q1uxAxkMaZVtgecsIDv/a07HftzksewMpTrSXP2GLK9LjIvxjuClLNJGit8LnF/kfXKlQaFpNhlrAM+4QKn/5oAh3JAghFZ8ZrTdBx4MNt4Xbj9WynRjOzAjjy40ov3x8qbA8E5Q1qr1VjVHAPFJ4DgOIHJefvjogbrWJT7s7EY1wh9YSWNai+fBN8CDbZIrSW/jI+pBPvtM7N4heGwU+H8ZZ1jkjKxA0XLp/XDbQfGVv1sFDd/l11OP9Vfpr6CNkufIIKd6GRf4SP7ieGe2Eq9ixCdI0d5tKLNnu660QiqbfSvMzllHpBv7hd4VXigFya8KIoGJt+ee7pYkjITvuYiKHWXfoYPGp+UnXx0hDDHceuvPkRBlpYSuqY8NdndKeoDUD4UfwHSV34e3qDGbyJFypsTC8nZ/Tmoeh4jKN/vc9mM40QT8V5eVzvw+URY3/Kci77Z/uYNgfU2SCubgp1oSB+anHwyVZp3IyRBABAhbDmtVKw3QL9rCXU2w6HSJFRTA+fesQwQu4r7KmWnh1iKfB/GxPew3TnoNODOdpm9T69LBkw7RJWy6zJuGXhtVfYbaf6OqZjyJD5SMsT+1JwKSKS3MR63CW24lCzQeujEPojvWmbFGxeNM9333CXuM1FnjRwL+C1LPMi19Vrf+ydr62mY/apLxLdYPHfDhzpnBuACW4ZfQzo1fTdZ2gMJg7ychu/0OlspKn6ihONDl6CFicmQ8M31elFWBBcELhv5AMDr57D3y7JIv6DX2eCRalVT8wgDfZ85A9JGJIsFaovCO1Yl5DFy+prHwIC0ESM1Uml8xIIZ8bfh7LBgNe8OWrclRZZ186OHSivac3M3UiwI5tIHIByO6mIBrDaF2wmSWXMY+TO9/RR1D41IllGwfV4XvrhYfwYI1cIVbqNsAAaExh0y/tKehBCBaHxl7E1sEpp0+X8EE9UhsduZA ZMOtmcwS qJ0OKFg2P0Xb7IY6N7Kbrq0o5GJhtZxntr73yJFYAZ4yfSVVQutc+i2l9XNli9kVUsV9RWXqTBB/HLtgyplUv+5I1165HKfEOa0h8luEaY32HnXSexqOXRTFH2QP4iht5dEt2cxvin0a/sQcwetns8n4prmGN4mbWOCjt0fEFEI9avJYMV8+DVgY4N/c8xdUJNrdVemjlE6vc49dtOUQKvpXZ9/UDpn6KA1ocK/+MHvHTrvb45RYT70/GgbschgJ+dBMKshoAaCAvrGTTfPHo8DTD3w== 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: Respect damos_filter->allow from 'paddr', which is a DAMON operations set implementation for the physical address space and supports a few types of region-internal DAMOS filters (anon, memcg and young). The change is similar to that of the previous commit for core layer update. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index b0c283808ba6..817acfd4f8a2 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -198,7 +198,7 @@ static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx) return max_nr_accesses; } -static bool __damos_pa_filter_out(struct damos_filter *filter, +static bool damos_pa_filter_match(struct damos_filter *filter, struct folio *folio) { bool matched = false; @@ -237,8 +237,8 @@ static bool damos_pa_filter_out(struct damos *scheme, struct folio *folio) struct damos_filter *filter; damos_for_each_filter(filter, scheme) { - if (__damos_pa_filter_out(filter, folio)) - return true; + if (damos_pa_filter_match(filter, folio)) + return !filter->allow; } return false; } From patchwork Thu Jan 9 17:51:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933072 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 59B42E77197 for ; Thu, 9 Jan 2025 17:51:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 219476B00B6; Thu, 9 Jan 2025 12:51:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A6566B00B7; Thu, 9 Jan 2025 12:51:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F13A76B00B8; Thu, 9 Jan 2025 12:51:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8168A6B00B6 for ; Thu, 9 Jan 2025 12:51:45 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E21FF1C624E for ; Thu, 9 Jan 2025 17:51:44 +0000 (UTC) X-FDA: 82988656128.25.9DDA935 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf21.hostedemail.com (Postfix) with ESMTP id 569BA1C0006 for ; Thu, 9 Jan 2025 17:51:43 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qSj+cWsJ; spf=pass (imf21.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736445103; 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=be2ysnXKMlhXMMO02SYrECTiYwVzwQRkNZmINRuQ9vM=; b=yB7p1CKV327n7QIOhoIYQQzrJrwuCgNNIGpijnc1TEl2z08PR7pcpxEGoNQ52rHYF6gCJZ XFMyOqKUh1p5+beW10n/oYCUMaTrXc8hMTF4uUGCSb37qksL3NHMLBPnh43ITCXhOe8VKd JZbGq4yt6jV2k2GdvMbL0pC5IK9/DfM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736445103; a=rsa-sha256; cv=none; b=F38CMj90fL4ROZSZ8JvoCaGYVps4c03Csbg1tF3ZdbYLz9hpxzLeT/OeeRul4tjZxbdvY7 A8Dox8pNfyINb1WHyxtvn6NNLhuNbasdyIZKvAoXpZDy9B0B8ExHCULeZM0XvtGHRqyFZV N5dHhbzxFwvQEjuE9fq3SEKThcTXaLY= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qSj+cWsJ; spf=pass (imf21.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 33402A42534; Thu, 9 Jan 2025 17:49:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54C31C4CEEA; Thu, 9 Jan 2025 17:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445102; bh=VTPumCjyOZzpcnH5UkJNLIwC7RykeAkPieOWziLnSjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qSj+cWsJLxLYLKIerVnKmUOKM4kdgjseSjeI8f9V7mRbskhrL5TAk4RFZRQXcZfiQ LN7g8yMoqdqifi4p5cyyYwifg3EcoiwCQ7ioHusB1wN9VcsNGfEZjR+1VDJyz5fW3W Qa5MY/JaiSPH6D6RLU5XRpYMdcFSj1V+v6AdVJzMty5/7avSWb+daBp14+J9eW7AH7 PD7YAiQyJjWADMlon0yZqvdeclzCnkeqADaRVeBg4/kI6jjz1Ukkt3eky9CdWfaeN3 RIEcmXy4BTz3la+Yp4OpJfMxwusNmakZsMIQk/jOqsLW7w+p/WPXS6ynYT4qjmWMNa iu+qLWHg6eleQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 05/10] mm/damon: add 'allow' argument to damos_new_filter() Date: Thu, 9 Jan 2025 09:51:21 -0800 Message-Id: <20250109175126.57878-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 569BA1C0006 X-Stat-Signature: rjefhd8udcgdazeajuahrwhf56hg9ekp X-Rspam-User: X-HE-Tag: 1736445103-975141 X-HE-Meta: U2FsdGVkX1+31VnQkhaX+glj0VrtlSqCg9sxg0VAbZ3PuC1iO9ushLsh4XgLy2o5bKFVUqm18Xy/KKIFB/8YDTbejXqqqpW6Y4b5PC1pZRoVyorNDHUoWwjm/lXsIWgZ6RCRDuI64okA+GEK2xZFKsxonwxTqpG1Y7PGxhdJnHQUdqzl+kSC4Akamb3c8RmD2KB6xSXR0cTqP8QRy34Wk39TJlSNmlUTB/wGeYVV0+3EaOwGL8LapBhfo7+UJm6qhY1dpb4sOHd14jOhy+qTBc4cPlX5X5eu98aI0J5zcQ4d7LBiVBDdPkavtJPSSEk4zFPGa7FMEDsjAzCaGkI8WF+g4rZ9LFQ3yWgaYBekwBgT/HWhdS99Tn4sybrcfhEZRAiK10zP0jizhWLdxyNofA+lJBTgJ/zgnhskJsdAVhZCY1Au6KQ4S3CNOjuQtlVvc6ycYxZQAnjslvfmkTaAddvVRKINlMEYV1/8BNkSUlROMTm7gqaP+ayCrJHiLbo58Cpbre/0xSS9Ng58kzuuUup07mPIBQd+2yRc7m3BqTM7XSXnG9SLeQk5axiA79zwK1oMq7n8xkcHWXB6CV4F0hUY4+mCe3lTe0e7RzfiMKIPuyBj9uVLxjmGZKM4gYMf6koVUZqTz6nDAiSLEZumkBYv2aPqXlJNgHHvXNDsRqtA77QQPTLsGBb8bCRdEvwN1MLeEXxwJSpXJ9Jzq1CWDYRW0lULUry6mHcf9qaki+VNoRrqdcCatBCylInhaRXyMOFpBRU0OFaeL5SchI9a4xLJwzR7SXF+p3fDw0hkd10yoVeyPudG5yGsWkqh2jzZnfLL2PMfozDEkU6OgzdWEYF0GweDySIQzTROrxwergAliOExanbFZhKsuIB+pgwWmC1pi1VYN19oHY2LmYrJdmTI1JfHb97xiejK89sgkET7YP6oBLkIzgmOxjUNh9u+94HDTViSRoje2IJxURV EMq3RRDR yIqfUH84+e3zu4p4cKwX71CcOr6cbF5TN5MBzbjA+qY8fz3Uj4xQn/BPmGQ3nXvJgxuW+zKfYR51+hQJLmnfF+TT9JZlFac5//Sqsbqja3HwW27mZ9qa4DwEegcp6QVdGpzmaR5fAQ1+ESXW1fEoqIqijX/csAEODYOuCNpI7LPj8duUWW2kZtoHR9dQ2axHpffA5qu91QWl2JjLDHjGJSkwdS8UoKTjcy+sSLI3bXA1cmWjIgxBCdqdrX6f7NtVL4shvH0DvT+jFeaNSQcQAwaptqA== 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 API users should set damos_filter->allow manually to use a DAMOS allow-filter, since damos_new_filter() unsets the field always. It is cumbersome and easy to mistake. Add an arugment for setting the field to damos_new_filter(). Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 +- mm/damon/core.c | 7 ++++--- mm/damon/paddr.c | 3 ++- mm/damon/reclaim.c | 2 +- mm/damon/sysfs-schemes.c | 2 +- mm/damon/tests/core-kunit.h | 4 ++-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 8a2d104df5a3..0834d7ffcb84 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -801,7 +801,7 @@ void damon_update_region_access_rate(struct damon_region *r, bool accessed, struct damon_attrs *attrs); struct damos_filter *damos_new_filter(enum damos_filter_type type, - bool matching); + bool matching, bool allow); void damos_add_filter(struct damos *s, struct damos_filter *f); void damos_destroy_filter(struct damos_filter *f); diff --git a/mm/damon/core.c b/mm/damon/core.c index 76707b0635d6..55a435bdd89d 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -266,7 +266,7 @@ int damon_set_regions(struct damon_target *t, struct damon_addr_range *ranges, } struct damos_filter *damos_new_filter(enum damos_filter_type type, - bool matching) + bool matching, bool allow) { struct damos_filter *filter; @@ -275,7 +275,7 @@ struct damos_filter *damos_new_filter(enum damos_filter_type type, return NULL; filter->type = type; filter->matching = matching; - filter->allow = false; + filter->allow = allow; INIT_LIST_HEAD(&filter->list); return filter; } @@ -806,7 +806,8 @@ static int damos_commit_filters(struct damos *dst, struct damos *src) continue; new_filter = damos_new_filter( - src_filter->type, src_filter->matching); + src_filter->type, src_filter->matching, + src_filter->allow); if (!new_filter) return -ENOMEM; damos_commit_filter_arg(new_filter, src_filter); diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 817acfd4f8a2..6b4397de4199 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -259,7 +259,8 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s, } } if (install_young_filter) { - filter = damos_new_filter(DAMOS_FILTER_TYPE_YOUNG, true); + filter = damos_new_filter( + DAMOS_FILTER_TYPE_YOUNG, true, false); if (!filter) return 0; damos_add_filter(s, filter); diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c index 9e0077a9404e..a675150965e0 100644 --- a/mm/damon/reclaim.c +++ b/mm/damon/reclaim.c @@ -221,7 +221,7 @@ static int damon_reclaim_apply_parameters(void) } if (skip_anon) { - filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true); + filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true, false); if (!filter) goto out; damos_add_filter(scheme, filter); diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index deeaf23c1fcf..9a883e8aea1c 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1901,7 +1901,7 @@ static int damon_sysfs_add_scheme_filters(struct damos *scheme, sysfs_filters->filters_arr[i]; struct damos_filter *filter = damos_new_filter(sysfs_filter->type, - sysfs_filter->matching); + sysfs_filter->matching, false); int err; if (!filter) diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index 8f58d3424c21..532c6a6f21f9 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -411,7 +411,7 @@ static void damos_test_new_filter(struct kunit *test) { struct damos_filter *filter; - filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true); + filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true, false); KUNIT_EXPECT_EQ(test, filter->type, DAMOS_FILTER_TYPE_ANON); KUNIT_EXPECT_EQ(test, filter->matching, true); KUNIT_EXPECT_PTR_EQ(test, filter->list.prev, &filter->list); @@ -425,7 +425,7 @@ static void damos_test_filter_out(struct kunit *test) struct damon_region *r, *r2; struct damos_filter *f; - f = damos_new_filter(DAMOS_FILTER_TYPE_ADDR, true); + f = damos_new_filter(DAMOS_FILTER_TYPE_ADDR, true, false); f->addr_range = (struct damon_addr_range){ .start = DAMON_MIN_REGION * 2, .end = DAMON_MIN_REGION * 6}; From patchwork Thu Jan 9 17:51:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933074 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 3F062E77199 for ; Thu, 9 Jan 2025 17:51:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E28346B00B7; Thu, 9 Jan 2025 12:51:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DB21C6B00B8; Thu, 9 Jan 2025 12:51:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C04CD6B00B9; Thu, 9 Jan 2025 12:51:46 -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 97A726B00B7 for ; Thu, 9 Jan 2025 12:51:46 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5764D1C6BA5 for ; Thu, 9 Jan 2025 17:51:46 +0000 (UTC) X-FDA: 82988656212.30.6F768C7 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id B1AD680009 for ; Thu, 9 Jan 2025 17:51:44 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=P8NlydKr; spf=pass (imf02.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=1736445104; 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=uDcVV+/QHzwh9jBJfBXo0hpUbUbzRbpugec7AlGNIQM=; b=OmefAMz52b2NTKAz2cKzbrOnesVoBIWcb60JzQVp+KHegEkLYm5dS2s3Mdjj2vQ0dVwYmo Onm5CLFqCoGsvSq7RG5m5GoSv+XLEwJvPZ6XyixzgLhnlgLezTmFjPxil/DCTa9wkROkrb gDKHUdZWj96Nut3nyFQfH/sILXQrFBQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=P8NlydKr; spf=pass (imf02.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=1736445104; a=rsa-sha256; cv=none; b=veuf4qlW9wZyjqPwhw9h/90b1QduFn+oRjc4fIBKeQ2KQGGIYOMb2cVA+4Re2dP/8xZKJX dOhDh7qbA0R3YCX2poYTFKMrpQDlhhQ8oTONcfE64jyGWm4huh+bhUz21mrcj7kUWH27Pe DcC6GZU7l3wJux6L7rsP8KyYOgHcVOs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D40315C5CC9; Thu, 9 Jan 2025 17:51:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E877C4CEE2; Thu, 9 Jan 2025 17:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445103; bh=qmaIUnx59dUjwJkr4G+Ggfwt4z+WkdllmHRXE6wuoJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P8NlydKrZFuP8R5wAjf7JbfscwIPB64jz+BGzzEkjRkiQZqySwJ97bJzTajtYLk+F 0xXmae4ZRT78XzzUs1KT7FmLdBlxWrn0RMcxKFtG7TO2kA6sR8YMDUTmrws2e3ycFG 2ttU3NmCipytEE+qOvbm25XhIsMPT6hQUQ2YCu6FSo4LXdibz9bnQ1QqJ9wYOE4Cjs rstP5YUKEr+Ekx6gMov2qd3AWBoffGg9Rd/b3dZUMjRaTLR+SPsAaATPfHLCno6uNc jQhulsnR2GHmgyX6YJVmV+IWHp8k6De+eqP+SueNmgk84xgIVzB/CHwqp6WhUiAnLT U7/MjPM6Y6uSw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 06/10] mm/damon/sysfs-schemes: add a file for setting damos_filter->allow Date: Thu, 9 Jan 2025 09:51:22 -0800 Message-Id: <20250109175126.57878-7-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: B1AD680009 X-Stat-Signature: tpqfet5mucemhq7rrxi79y7xi7znyc8h X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736445104-495921 X-HE-Meta: U2FsdGVkX1+btuvBVm50RBIJJQ6BnKLOz+t8Xd49WmLR6wcZeKE+cZMoBmUJtAZr1e42vAbGOrDvw1pgPOM8czxbHiFClSnkhL5KSe7a/psh/SYIzV8qF0rNJkJTn074+G9gJXKUNkrvA3cCtGxAd82cYKU9zm0uynQJ5+Dak0RmZOcAviaGOFl9s2xviwfB+LtoiT8TFMZQQH09xEuC85XnNSlWhX3eZEf6y3X4W6IgMn0kOQM32AFzwXSu9Sjmuj5TbEBdu92KCQk+Lr+w+H1mi17eblUu6IUEX/xvE/JCnhwEw0y0QXS0THXGAHb20DXq1qRcYINGz1p9SazfbkoR+aziqrBpKiFu9GeKX/xZRgjcZ7nb9PQwR2YGRXTTeeyikZEGLX6qZqB2CnXjM+PXQgwyIfH7MsWuzLi4CbCuKsAQ0B78t1jGWCwsFnBT3D2NntYHo3X5oHnw140wu2de5j4OxyL5ORpC3nIMFhfzUy0rKtOkON0+ym8t4gNR9euLjFCifJHVelipb2MFtbSun8UyF2wA4FEiUzUaWqHLYEl3eXk1PjtD0XOB/UD/SpunZsorjUddH++F6dvYYN4aphEpyPGQ4QrbzFmK4GfXWCb2nZCAoBYF8xgeoF2nobYzgJRmR7KmxTMBDeovNvv04Hnqq0RejqgzrU1Izlbo5/90tPgTYlqkFVyw+VCTB2BblBIBYD+j7RMWSQ51WSXoz2KOEPMwxAg1luL6kxtUNhqtf/2PdhUJ0IeKNHGXVbtunSWDv/iai6zuZczfySl82f9fNLuAv0g1Uih+puWQM6y1tJ+yRRvW013EhqvKmBnera1hLOJKLV3Yn7QEN3PCsRtKF9ZMD9Zc7erMM+Owyf+j9XxGP8zOKF8FZdNtg23XZUlLNEs5q2LGki+BuUpkAcfUJfhnI+OQ7IaXc8ZLKQcYP04FGYMow7ckEi5GrmFc9L+MLLzIPE2thMt Ll/mxs1G xa/+w33TWcyy3EIIorhv2ji+YPsIaECpKbOil2vnsq/PXkGoKoO+oeWUEQAxJWgpf7N3HDeUj8UgyMz/42yhiB8k8mN+q6AJ93CHdYKFA0r9EugHW8QveCTzaZClk4rfDSZuRnue+Ax5UaBrYpcJHLTZT35H7wPMAwtCgsJ2tvqxIvfHe9zo2JQfbbeUvyJVSxzQ61qitrVn8+ac9vG9sWVw6UDWVvZGH2ax1ChZvQ6rhjoYb/Syye/5ltXvxFdNSBbpXb/WKHjsVY3q6U6fruTxFkA== 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: Only kernel-space DAMON API users can use inclusive DAMOS filters. Add a sysfs file named 'allow' under DAMOS filter directory of DAMON sysfs interface, to let the user-space users use inclusive DAMOS filters. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 9a883e8aea1c..98f93ae9f59e 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -313,6 +313,7 @@ struct damon_sysfs_scheme_filter { struct kobject kobj; enum damos_filter_type type; bool matching; + bool allow; char *memcg_path; struct damon_addr_range addr_range; int target_idx; @@ -385,6 +386,30 @@ static ssize_t matching_store(struct kobject *kobj, return count; } +static ssize_t allow_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_scheme_filter *filter = container_of(kobj, + struct damon_sysfs_scheme_filter, kobj); + + return sysfs_emit(buf, "%c\n", filter->allow ? 'Y' : 'N'); +} + +static ssize_t allow_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + struct damon_sysfs_scheme_filter *filter = container_of(kobj, + struct damon_sysfs_scheme_filter, kobj); + bool allow; + int err = kstrtobool(buf, &allow); + + if (err) + return err; + + filter->allow = allow; + return count; +} + static ssize_t memcg_path_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -482,6 +507,9 @@ static struct kobj_attribute damon_sysfs_scheme_filter_type_attr = static struct kobj_attribute damon_sysfs_scheme_filter_matching_attr = __ATTR_RW_MODE(matching, 0600); +static struct kobj_attribute damon_sysfs_scheme_filter_allow_attr = + __ATTR_RW_MODE(allow, 0600); + static struct kobj_attribute damon_sysfs_scheme_filter_memcg_path_attr = __ATTR_RW_MODE(memcg_path, 0600); @@ -497,6 +525,7 @@ static struct kobj_attribute damon_sysfs_scheme_filter_damon_target_idx_attr = static struct attribute *damon_sysfs_scheme_filter_attrs[] = { &damon_sysfs_scheme_filter_type_attr.attr, &damon_sysfs_scheme_filter_matching_attr.attr, + &damon_sysfs_scheme_filter_allow_attr.attr, &damon_sysfs_scheme_filter_memcg_path_attr.attr, &damon_sysfs_scheme_filter_addr_start_attr.attr, &damon_sysfs_scheme_filter_addr_end_attr.attr, @@ -1901,7 +1930,8 @@ static int damon_sysfs_add_scheme_filters(struct damos *scheme, sysfs_filters->filters_arr[i]; struct damos_filter *filter = damos_new_filter(sysfs_filter->type, - sysfs_filter->matching, false); + sysfs_filter->matching, + sysfs_filter->allow); int err; if (!filter) From patchwork Thu Jan 9 17:51:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933075 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 D705CE77197 for ; Thu, 9 Jan 2025 17:51:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D64946B00B8; Thu, 9 Jan 2025 12:51:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CEFBF6B00BA; Thu, 9 Jan 2025 12:51:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B177C6B00BB; Thu, 9 Jan 2025 12:51:47 -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 916476B00B8 for ; Thu, 9 Jan 2025 12:51:47 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5490E14030C for ; Thu, 9 Jan 2025 17:51:47 +0000 (UTC) X-FDA: 82988656254.14.5E02C32 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf25.hostedemail.com (Postfix) with ESMTP id A4187A000D for ; Thu, 9 Jan 2025 17:51:45 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=IMh+T2KB; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.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=1736445105; 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=HoTk9nk6W/ifF98vVvdxLOKzuthUlirGZ+ZWTKhGMtY=; b=8VV34ExiB4dZvPlfFujiBNJktZNq23qpGH9eFzBIIE7isr/n/8E6hzPzWd+m+KogCyipof BNLwDuHt8Sji9A/RqJiUHvAakqLp3ihIUIRC78iInxGQJAwlXsM0G1D1QoQzg2GgEzzje5 cWaHBtyT/9HMKYfqo1LiRX7Ey6fSpOw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736445105; a=rsa-sha256; cv=none; b=fGDDbepiHEmblA1gUCclmq/TQ6jAkOG/BvIdqo+z2YhG/ZDNx2+kz+dVPNPoqQk/zGBPOA oScj+BBFN7y/63m2cVU3EdiB7nwWgRnHaSTGELGDKtbMiW5BYFKmb6xgHdJZXui1h2RN+c 8WrKqU5ImjIkdC6wGs6dxeFpAuQf0Us= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=IMh+T2KB; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CE0AB5C5CDC; Thu, 9 Jan 2025 17:51:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AC9CC4CEE5; Thu, 9 Jan 2025 17:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445104; bh=D5K8J1LD/PiUXT0vcupBmI3FxsSeWohef6Oiv0g+Rfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IMh+T2KBV7HCpVmbGHyYNBHIs5nafW8flfKwJ8siqr6+f87zJ2q+W0QPIMWaUAbF4 YUX11l/s0wpwVZZCj35/WeG8fRW5kuu0xGMp/W+raK3N66kk15nIZV4GG1q95qEa6x 0Aap+9qtd1SV8m5hKzSkFVSb6aAvOITaRlZtGEPmP5ZpwJdt3FauH1BzvrhlfeHOs2 kqAfpB5VAQS/KTqHBt8Opp/kKhqMxjogmWkBQK94vpWZ4UtxtHhv+4uXpDlLwcyGM2 YNkAZZ6SV/v1KJ1Lt0AxMiQgUSzp8CjKKFqN6Ahe7DaKsayGVTcHBdSEA6ZtB9w4bC WSVHI8j/7bvSQ== 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 v2 07/10] Docs/mm/damon/design: document allow/reject DAMOS filter behaviors Date: Thu, 9 Jan 2025 09:51:23 -0800 Message-Id: <20250109175126.57878-8-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: ciso65onyr9pih6ij7e97uhuk48q9phr X-Rspamd-Queue-Id: A4187A000D X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736445105-997192 X-HE-Meta: U2FsdGVkX1/sH+psGNqOI/40yxT1Frfh8oxpWipSwe1ofGFv0IVUaZ5ugB6BhW0KXFIH7Y/vrdMIvQRSGTSbdUpf63ikkYQmgGrKfpi0B49D3Jj1mEOLi210sjdlObEUldW69nJe7+cOrL8odHwDTWqkFMqP/ewutkzAkG0rc6YU6HUKxIXK2szdoC5nkP5EijkJ2JptcZKo5520jNgyTRsRUqmEadyqsroRr9eB8+rNoktSycptDNx7BPIioNRyk6WNLoSEaCab7CVGNZ2J7gI+LdzsoXSGrWjesJATRnP9tMiYcYDhdlTKzBlbz72KP7JImUoWV/GEy/mirCFBodaRB5RQUIHYFp5nUOeUnTBJpB+XxNvc4TGodtvlK3h1pmUqUaOpMGQAmlkkKs1YCS5UfRVWgWgepf9SfnQ540KV4Y4HceM4fWjGjZLhCicGq0ChvyO6nKMDNieabvD2xDaLRe1mxRg872B7wDQOtUR0seUrrTI0FZVal9V8o7p6iT/5CqrUaMr8Eu0jY3jCNPOWpQlgrFoSm4lPji6jgEe3/SQ9sgi9WBFboooScKcfEDmKsPhHPW14Tr1r+pl+McR10NNnUh1vLCJOwxBvCBssskuz+BxSQliDL+cYnn0bXNe8MvchG3LsAkbHmpgbFOG5zC4qJG4SBIemsa0dvV4mxQHwdNaJ23N4TdaGz7P9p+Zv3sDpT1oydsGzpr0gMfYa7JIg6OPQ8ZXoOoMbcAPaQAnnkC12OCJTmVDR96ct4xW2PpdXp0cAUuX0VKCIVealagNGaRzyysh21VjP8VE3lMI3LySCMwuPqf5iGWkBxIVKGjkIB5YSBN/OGTjteao43FIqxY1M5x2A/era8omnns+RBW/qkpy6TDTGfgJ2fKCpa98Q6hW3zdkbz+7GXozfpouJT38ok3vsi4yK9WjUhJUz+8NP0gdBFQXBdwAVUSEs4Gv7LcWbNzi8CuF HJEkZxvg dHbrJPdQI7sjMMGuiFSITqV2QAdVb6SJSN+MwdgWIkUif1sCSg4+HKUIvUU7X0KASqDEY4T6PbCOm4W9TPcX/bF2WCKJoyYxzfaC6ziBlGcEeLq9A8g70v0/B9s/z0vqmjg8SS4ug4EqpZ5wn3hvC6bfzo1gZYy4PYWCrfTe98Cy2rAHlt2f9tbojWclf121b/AaISSOf31NlO2mu9B9ZkBVdpyzaeNi6oZhb1wN8Pm+un+E= 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: Update DAMOS filters design document to describe the allow/reject behavior of filters. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 33 +++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 449eb33688c2..667775bab86c 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -504,9 +504,34 @@ have a list of latency-critical processes. To let users optimize DAMOS schemes with such special knowledge, DAMOS provides a feature called DAMOS filters. The feature allows users to set an arbitrary -number of filters for each scheme. Each filter specifies the type of target -memory, and whether it should exclude the memory of the type (filter-out), or -all except the memory of the type (filter-in). +number of filters for each scheme. Each filter specifies + +- a type of memory (``type``), +- whether it is for the memory of the type or all except the type + (``matching``), and +- whether it is to allow (include) or reject (exclude) applying + the scheme's action to the memory (``allow``). + +When multiple filters are installed, each filter is evaluated in the installed +order. If a part of memory is matched to one of the filter, next filters are +ignored. If the memory passes through the filters evaluation stage because it +is not matched to any of the filters, applying the scheme's action to it is +allowed, same to the behavior when no filter exists. + +For example, let's assume 1) a filter for allowing anonymous pages and 2) +another filter for rejecting young pages are installed in the order. If a page +of a region that eligible to apply the scheme's action is an anonymous page, +the scheme's action will be applied to the page regardless of whether it is +young or not, since it matches with the first allow-filter. If the page is +not anonymous but young, the scheme's action will not be applied, since the +second reject-filter blocks it. If the page is neither anonymous nor young, +the page will pass through the filters evaluation stage since there is no +matching filter, and the action will be applied to the page. + +Note that the action can equally be applied to memory that either explicitly +filter-allowed or filters evaluation stage passed. It means that installing +allow-filters at the end of the list makes no practical change but only +filters-checking overhead. For efficient handling of filters, some types of filters are handled by the core layer, while others are handled by operations set. In the latter case, @@ -516,7 +541,7 @@ filter are not counted as the scheme has tried to the region. In contrast, if a memory regions is filtered by an operations set layer-handled filter, it is counted as the scheme has tried. This difference affects the statistics. -Below types of filters are currently supported. +Below ``type`` of filters are currently supported. - anonymous page - Applied to pages that containing data that not stored in files. From patchwork Thu Jan 9 17:51:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933076 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 5AA43E77197 for ; Thu, 9 Jan 2025 17:51:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EED1D6B00A2; Thu, 9 Jan 2025 12:51:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E4B266B00BA; Thu, 9 Jan 2025 12:51:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEBD36B00BB; Thu, 9 Jan 2025 12:51:48 -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 AE08F6B00A2 for ; Thu, 9 Jan 2025 12:51:48 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 57C7AC033F for ; Thu, 9 Jan 2025 17:51:48 +0000 (UTC) X-FDA: 82988656296.16.DDAC0E4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id B3AF440023 for ; Thu, 9 Jan 2025 17:51:46 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=REsmlWwh; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf17.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=1736445106; 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=DsV6f3/GOh7s6tKRPZCWfJophuTD7OpqAsZaAvglA2o=; b=TYS4uvuObWRgWyO0DyHj1r+dTcpLaDfyPt7Je7QqLMn2Zf6wEOtvQmy8xwEmr1e5RbJJNU CYa5omH9+ykBKJcTdLeNbe9WlfmAqTUKS3a+UmmXSymnKx33TbI7N1TMIphfUbsM1oLs6s GtVCcxRo9vwSTFBHV8SOmWP88SEM6dw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736445106; a=rsa-sha256; cv=none; b=PQ2I7vlcxXnwoQiVl+noMyAVNoBz5osbCzsIiTe++zCm7Cg2WxQ3h/MWPfgGDUlxXQjvTr WV8ctqI/7VxbBncXsFQjYa7kcBKpWHHLRDoxPpyNxL5YEGUiLFKval4OH+ScgirEqnelUF mGBx4wRoULhPAbiP2CXYDdoAdz80Ssc= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=REsmlWwh; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf17.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EBE7C5C5CC0; Thu, 9 Jan 2025 17:51:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96E17C4CEDF; Thu, 9 Jan 2025 17:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445105; bh=gKQlLARsVrrph5NrbcUYgL9T8fplC1mlIWF/4YxuHGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=REsmlWwhB0dudPGHboz+PDVelqGDAeP6LkzFmqYWSqf1lAqHKMJxvJZa6W0K+z687 0Tzm84jAynQdcg7cHsGQNJNoBsNT85GuJrSqH6a9FbQ+tIdkuW5Kd7YYRf7fec7btw 4+S9cbMoAT1ZIt3cOGSyUyZIlREp1jbEdBarzaHzGx4uKzgehkl/K10y29is4Jy9N5 t/TP56RX5xrZFvovNwENPFm5ceSUyXhrcYqkTTkgP5+9FAB27r1xqRzLABV190knSq ou/hNqpn2JjORBElpBaNQIdAe5iIAlWbH9s39eUTXTRtcLbSWdExCMRa7Uk387r05b Uq6JDI1p6oikg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 08/10] Docs/ABI/damon: document DAMOS filter allow sysfs file Date: Thu, 9 Jan 2025 09:51:24 -0800 Message-Id: <20250109175126.57878-9-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: xhbjqof1si3go66768eag1s64pfonmi8 X-Rspamd-Queue-Id: B3AF440023 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736445106-423155 X-HE-Meta: U2FsdGVkX19fLXUOjbfC4dP3b191d6mG1qwnq5uQDqdxxkTezwuDHlRPMnA0w1Qic89vq9AGDX+0XQoDtgctO+5WuDqYJQXxBg81gLjYUEPPQrBULxQPlbMUaRcHpYdFKxPrOB/uSI5XssyYtgiwvx8aOAI9kcZzo7X7/iBS8lwtwoXmv/5wH+b8G42F2roghccvY9jAV9qfqTHqiEYebT7BrhihhH0TF5eoMJBHZunX0fyEiJLAJ6GZhVpI0xfpMsY3qTDCOTEmIc+OeBGJpgvL6FduA6GTHsrf4YyStT7DZ3BsqDB2lLOblU0Xs8xmyNlrKW2l0z4ted1yW1SLfVmT674RbBA1iIdhneRLHxnxXXQ5bofEnoqC+vwXNeCI3EMvHHITmcWDhDR5ZeCoQgh7s1aNvdcnc6rEjUxOI2ch2bbPIMcqteeKGWYSqLos3l7fCUmKbJqlVg4jBJuK9XdRpxhg16zoL7bQ9s5xGwcQ5SJNABQq2Hrvs1b3nxUD2x6P1apbcvLqergpFdrV07KkSlEgp7lNuMtQ1CGztIqugriMYcrKknTBCd1Qlij1lhB0A+gCY3/IV9l+FvaV5Cnv8KwfrC1VVmxJ9++tDsGyNM48wykHPip8yvRK93mZDvguCH1pECUpfthzJmsanP60MPQF9ub8jHxzCg336N/Es/KY3LD3VKhmvG6L28uYP81UWlo64e8U4tECjFK1fCP268dVJ1iQTVbTU3xYj+QZ84b5M8g+6hu09hrOvhHg7MDEUwt/5+u8iDxPjr511AOvrvpNs0nz8y//l7eYCQj+Uue+vEz9diqkVhGonnyO5KH5KSClya7WQwfg3AFyGeyvM1EdYIoekCxiz9hHe849W4pIUO3LABAAsIgjTCbHG+WmYMWVMsdK4xxzEowyU90Do9QhEtzqn4AYft1F2sB2hyZV8PXnwHQ7IK2A31Pq3YJKuE0iWFFl5y9okXZ oS6K+qcQ RVSondkOxr+Bw6x6DC6zuqSZiBzvTRDSBOTMEUnBZaKPCDqnx6i4oc41mK68V8lJmBJeMQvsfTvBxAPB9hYtzpwgMTdC8ijIZCG5ANsnxhJabMbNRF9N/CwxHzO94KN71kFD1xdMlXTo9MTrDJzoFgjgE0UyvOAbnZlJ3O5zpi0FldyJbqHwi2H8ZOWGS9VAruqFaWC25bC2YNnRCl2EG4++l8zQ5qdvSRa7Jczh9CFdlZ2mTehOAsRjtFXkMnZYG7+pyEVhwGsAt268= 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: Update DAMON ABI document for added DAMOS filter 'allow' file. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index 8c0acb31638b..b057eddefbfc 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -355,10 +355,15 @@ Description: If 'target' is written to the 'type' file, writing to or What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters//matching Date: Dec 2022 Contact: SeongJae Park -Description: Writing 'Y' or 'N' to this file sets whether to filter out - pages that do or do not match to the 'type' and 'memcg_path', - respectively. Filter out means the action of the scheme will - not be applied to. +Description: Writing 'Y' or 'N' to this file sets whether the filter is for + the memory of the 'type', or all except the 'type'. + +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//filters//allow +Date: Jan 2025 +Contact: SeongJae Park +Description: Writing 'Y' or 'N' to this file sets whether to allow or reject + applying the scheme's action to the memory that satisfies the + 'type' and the 'matching' of the directory. What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//stats/nr_tried Date: Mar 2022 From patchwork Thu Jan 9 17:51:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933078 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 ABCFBE77197 for ; Thu, 9 Jan 2025 17:52:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 660176B00BA; Thu, 9 Jan 2025 12:51:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 60E1C6B00BC; Thu, 9 Jan 2025 12:51:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 414116B00BD; Thu, 9 Jan 2025 12:51:50 -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 D56C16B00BA for ; Thu, 9 Jan 2025 12:51:49 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 835BE16031B for ; Thu, 9 Jan 2025 17:51:49 +0000 (UTC) X-FDA: 82988656338.18.B39B928 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id D89F1C0005 for ; Thu, 9 Jan 2025 17:51:47 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rKs0gZ2C; spf=pass (imf10.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=1736445108; 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=cJ0bsAZLGHO/ui9QK+muosvWX50TfLnI6ItwdWh/3g4=; b=JfiU/YIUSBEj4LGvmwzrG2OLCPwjiglw3zCoOSpUQFCduqULjAQS47VLS2KO7oIaIIe4tf j7U2UEYBqG4lHsgR1ix1h62xz8Sbg/0pm3+VQpGyjCkQiy9R7/T8ogNKRz50YZO54sja4o 44vWDEdflStz5VMGdQPp6FwMclgztW8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736445108; a=rsa-sha256; cv=none; b=JG+OlrHW1WFAlXpXI6yR0nvzyLt4E6f281wNgvpjrw3ta8CFLNh6kGXjVV0ib28NusSFsz ZaOIvletfktJpFp7QD16/C7zCO9QfXeN5coMTL893gno9zTjRHuWrqizzhV8ld8nDghFhX 73txC50F9ixYPoPtArj4teCPEV1VhBU= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rKs0gZ2C; spf=pass (imf10.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 2AFD25C5CB5; Thu, 9 Jan 2025 17:51:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE997C4CEE2; Thu, 9 Jan 2025 17:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445106; bh=jufb0sHL1L5krYu5xZ9uPN7YQ+OC0Evk60XYWVCJy7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rKs0gZ2C2Zr7ye0+OdvYEFCw7MIAwCeZdC2N8tWy4GVn4gqpSrTU7VrYj3WjuFhqO 5ce6wlNJZQyAnYW+nf/hOeQ12qJSEqq4eQQ3TxdqiC0BPTSk9lmpbUp8mYYZSaCHya 79gYNA9ADpr5cESKx22cDAD26PJlLwu+4wXbFrCEcXojhxA6X3v4iYwjFb9phohury /nY9pAi0O/WhTiCg/NljqXn1nn0h/QqpvhQg8+hAkklGxF6sz2kUpNxBSWCRBarehj gkKw4cmmJNz3NIXzTIpQkZxgX+5QfAf8wPXiPC5YlZ+hPAeq+5QySqn587rIl5lnwY NaMsiIiHl+eQA== 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 v2 09/10] Docs/admin-guide/mm/damon/usage: omit DAMOS filter details in favor of design doc Date: Thu, 9 Jan 2025 09:51:25 -0800 Message-Id: <20250109175126.57878-10-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: D89F1C0005 X-Stat-Signature: 6dpd5dnga95c1uu3dq7zqwq16gpwtk3s X-Rspam-User: X-HE-Tag: 1736445107-975762 X-HE-Meta: U2FsdGVkX1+i0qLoeWtGtPCmAqMmkxfI0II5hSkfpKBt8QQ0PBIPjRLFqHqoOdcnchy0DbAOu0gHj41yQSzpdNZQOiQJuma03AR2lM0rpJLQYbiZkF+/fkIyZs8nlh0M32h80kGZRyP5rOTwwL3AXGnRtvZxPh9gl9YgdZAgojIz7mpGzyARioe66Qskrzp2ym0WqvRj+3N8OBMF51r12T/A4BMQ06pcjTU6NnDCeFDt3MPSk9wANNVo2tRylUL0wHM8MytuiUp/+QLXnsSFRLRyB98p1QEl5DAUahbC2wnQUNVhipYnX/V88tuVNX9vtyLZitQDB+pyw4lkw1K89CPhZLjmRfv8vDg8coQQhdyqmsK+K/8xRGUNeosCXyjMxj76kmgIZvvCzgXrfj2T2a1/4tyzYXTjorQd3zyo8PnhG0Nq111NhM3Aqkr/aFHLHeFvLggX1+ZrBM2oiSSiHITVBkC65O91oCEGva9bq5jlbsmByM0wWIDjhLaCtJfWIzKtq1mqByVtjPxD+aAFwEvs1Dk8GVubrp4yppvHscO9zuSQbm5k9MkkJw6+3rvyJ3E8ZEs7x3f+d77JvI3n8MCgcjsZqy8scyGDg3Ka7NVyD6gOJoR13kBHucl3P5XXpXE5aGn/14srHrRHWOkVijh6rdor4ftds5ILnNxL2nz21/3vne0h607Fyr6UrtuAcsbx5lw5pK2ttGq32kUrWmP0qU9ooXllixVP9ILzPzn2NOzqrR31uM93xIBGtx4z89KhvZSt+A5jXjflJZVik/015chdOYB6N5KPqdhXNXh1/M8HtM1foLoZTMi6g+NL6tY/GsgobBF/kzDr64to1QXPPvaEtfLLGPD+PquIX1xj3XELlEKfPsePRqO7iHQPSX7SVpUDA0Gq4NzsJieuxWKYoN/QBZMb2dwmhbs2g7YDokwIQHv3mpBhjHPR5YdD4Ej8FN14BFD8bjDLjNP DJhF7Z2C EQommv7bTUXJvs4dOdZyBWXfJkxtCfi3YFmp6TiNtasqIMkVsarw7jzxQPRZLBXJ27iwEnbdHnVBuXhSnRxUcFs97UsnIfHYxxPexV1bP9KZJqf8wx01CKQwkVRPUTBtYeSaMbqJvhyDN3TW3SPmbga/XXDAobXVfZSLtOHwoyhKgh3OIQtUxFYMWrLN+wGVeQerCmAIH5Xu9iSAlx0PxiJj3Nqob8UUO6O2mShDZxcs7rVxLPYV2e7X+JaTdfEjqHCEwvao7sfSzHE7dj3kfQphYEdR7sQoJA/qYW7tqv5/0fRq7U2Xlmf2PG1JK3wS77S+op8JnM1lFlIcTsSWmY2EoHN0X5hJdWrxL 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 usage document is describing some details about DAMOS filters, which are also documented on the design doc. Deduplicate the details in favor of the design doc. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 29 ++++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 71cf29ae8502..8df3357dcfa3 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -411,13 +411,17 @@ Each filter directory contains six files, namely ``type``, ``matcing``, file, you can write one of five special keywords: ``anon`` for anonymous pages, ``memcg`` for specific memory cgroup, ``young`` for young pages, ``addr`` for specific address range (an open-ended interval), or ``target`` for specific -DAMON monitoring target filtering. In case of the memory cgroup filtering, you -can specify the memory cgroup of the interest by writing the path of the memory -cgroup from the cgroups mount point to ``memcg_path`` file. In case of the -address range filtering, you can specify the start and end address of the range -to ``addr_start`` and ``addr_end`` files, respectively. For the DAMON -monitoring target filtering, you can specify the index of the target between -the list of the DAMON context's monitoring targets list to ``target_idx`` file. +DAMON monitoring target filtering. Meaning of the types are same to the +description on the :ref:`design doc `. + +In case of the memory cgroup filtering, you can specify the memory cgroup of +the interest by writing the path of the memory cgroup from the cgroups mount +point to ``memcg_path`` file. In case of the address range filtering, you can +specify the start and end address of the range to ``addr_start`` and +``addr_end`` files, respectively. For the DAMON monitoring target filtering, +you can specify the index of the target between the list of the DAMON context's +monitoring targets list to ``target_idx`` file. + You can write ``Y`` or ``N`` to ``matching`` file to filter out pages that does or does not match to the type, respectively. Then, the scheme's action will not be applied to the pages that specified to be filtered out. @@ -434,14 +438,9 @@ pages of all memory cgroups except ``/having_care_already``.:: echo /having_care_already > 1/memcg_path echo Y > 1/matching -Note that ``anon`` and ``memcg`` filters are currently supported only when -``paddr`` :ref:`implementation ` is being used. - -Also, memory regions that are filtered out by ``addr`` or ``target`` filters -are not counted as the scheme has tried to those, while regions that filtered -out by other type filters are counted as the scheme has tried to. The -difference is applied to :ref:`stats ` and -:ref:`tried regions `. +Refer to the :ref:`DAMOS filters design documentation +` for more details including when each of the +filters are supported and differences on stats. .. _sysfs_schemes_stats: From patchwork Thu Jan 9 17:51:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13933079 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 A88E3E77197 for ; Thu, 9 Jan 2025 17:52:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 638326B00BC; Thu, 9 Jan 2025 12:51:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E8BE6B00BE; Thu, 9 Jan 2025 12:51:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48A706B00BF; Thu, 9 Jan 2025 12:51:51 -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 CEA526B00BC for ; Thu, 9 Jan 2025 12:51:50 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8F8AA434C1 for ; Thu, 9 Jan 2025 17:51:50 +0000 (UTC) X-FDA: 82988656380.20.D9C2F43 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf26.hostedemail.com (Postfix) with ESMTP id EFB65140005 for ; Thu, 9 Jan 2025 17:51:48 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LYYfWteP; spf=pass (imf26.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736445109; 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=tsnQFEUzcsbshXorE48/5V+1uFEn/6KTjlN9S3klmwM=; b=bykWaCqK28TM1xc+4p5cbmXCyGhpJrdx6C4MYFCv477tp3olDxs4qAnRsCQBQGn8a9A09f SKCMru9YrkZqFyGD6YFW5Ld7FXFPvtYx15fZhtF3P4ujBrA6BfQhe0Qrw7nF65os0dbBGy eaaeR3M30CSI8Hgi7/bl0c+BGlXCmwk= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LYYfWteP; spf=pass (imf26.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736445109; a=rsa-sha256; cv=none; b=HGdNiVGJdzSjAjBp8Xlgc6ZpgRYkC2nIEGkaflvG30bBF/cpzMiUrgyCvxFhauifUT2w64 ml7ywn8HcQ84YOY2Xm349/O1q9aic6M9E/vmpNePkodZ+VUfIeh7R4FoESglSr8hmAR1rS /4+HBUxhmi81tl1ljnEODY8X2TORDmo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id C7AF4A42523; Thu, 9 Jan 2025 17:49:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE000C4CED2; Thu, 9 Jan 2025 17:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736445108; bh=IPoCvtuIbYdm4duAoYfcI65fUkKJC3T/ANKcwt19fcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LYYfWtePMZTuxd4s2GRIBuHgMcxlCm6/g/nwHTX+qzJ7Q6oLzDb2N+B1qx/ANy6JG L1b4uwDm3AKkYPa/sfWJjSAL66RbSTW3nLyZWT9jTaASpJ4cEXQ74jjvoyilcVQY1d PP7mKtMt24H07N0YUyegP4mhDWuLcRUT9CUFr2gTBJQRpEUpGiCB83EIe8lfy2Xhzu oTP6cwo+p9jhLLfM95fIY6vLvK5qkcacQKOoIytnlhKZccWnrLkiW12ZH6my+gSpAs EQd6ed51aVz/lHT/cjkYTLpliY6WIn34vQifkLkZ5cCzCG4V6mPAg0TeF79cD7jOhU yuOlq4RRSgFHw== 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 v2 10/10] Docs/admin-guide/mm/damon/usage: document DAMOS filter 'allow' sysfs file Date: Thu, 9 Jan 2025 09:51:26 -0800 Message-Id: <20250109175126.57878-11-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109175126.57878-1-sj@kernel.org> References: <20250109175126.57878-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: EFB65140005 X-Rspamd-Server: rspam12 X-Stat-Signature: q5n3h4u5ifie164nkw3esqe8ksrtn9dw X-Rspam-User: X-HE-Tag: 1736445108-438279 X-HE-Meta: U2FsdGVkX19Dtw9GXkdoH51mv1tGPXS6zEmbTSvDlgx5vzz7Hq8ees6Ob/FMwZs59g4fRWJxoqFmnbAqF26ZQRvC7pj+Jh5fkU3i0N8qRM9Ct5y6WJsI0il9vdBZDKL6ze3ZN3QdiTqP1OCzczl1sIhSjxLxbU8UqiI0XCNxMDWXUk1lSw4i+X7Es+ItS0Tg2VsnbHXPyucrzO3Eyw42zzfkTHcuyClYehg2ezcuHvXJoyM5i5ov0NRrxXFD9LFdn/wB2JABLHwzbmJBQf/L9RlHu26C4zgP3VHwU8AaV1KHVEbJJ4zuoHRHJK6MRxoTN0dPE8qpUpMp+cv6Mpyg+hT3sV3idiEewYgBTRncz7MoIKN8DCWkATpuWM6ET2JTAjTIXsf4FwS77ZUCNDiQnCIGU9XKudwCGvO3qBPOGVJiy3rxvwPJlreY+pJRGvfXNZpUU9W7W2dySdY6l9bNGbHs4AaN3oSbaUGK7H7hg7rNaviYfX/bkztm5ELso+4H0An2IJYXhC4u4cKNc4dwnacOf5SQhl6/ckY9OVoEf74uByPX1tIpQmTxwtISCM0db6caT3+H6jTpL/BMTNJd4R52UAJL0+JNY2fNT4U34w07CEbW2OveNczdrQSlZI3iKoM6pyw3sOpNjiaQ/cDzr5h6vE50rMyaXke0x3CGwHOyi/B2nfL6qwTJvBt16Wkv0kqH310Gn490bPUtLNEfEENOk3sJLp2hyVno0vY77A/VbGP4PAKL/3EPs2MYBNF++m6sNNij+flAjKGuKwv5I4XahlYEB12vl/J8wQKWTyQOe4fE4LHDYS2a2wR+6yhcr1wBqULIKW+cUS2NaRMbKf8Arqw1ke6gibAFDXjNfoIE+IdKyk/Z8WnOrwhoaF0EvnRJ71n2fSqUq5pAyGGB0G0/EfrvZljVR5jYRq16Cpr1SXVeaICR4ETBCH8zbQIVyLR+Vo4tRKYIyMHU4YF e7BRcDoc wwN9SHx/NGfhxk6yJKKJe9h7VffX/j2QMpv9DG1auqwyqpC+ZYez+0yaTKkm2Qgj9fUMvBxSAu18A5QvTg5QSYhdO1hIS9dBtnUDCb16w9TaCW17UHCEyjHRDHiqJRXROX+GcmeyXwnUFIEXFHdkl0d0blH0Qnm6h3x66DhIDzD/xc8ODZs58gy1GbIaZHMm3J+IWhTKnzCEr8wC3H4geVYw51U0bIrkAakKz8kYdN5WImXjWglTofZrkaiLMpLHidNfebRn+bUJbA4NlOKrzC44uaYCkE66P+i03f+pw4vRlGJ0= 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: Update DAMON usage document for the newly added 'allow' sysfs file for DAMOS filters. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 33 +++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index 8df3357dcfa3..f0d0c20711d6 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -83,7 +83,7 @@ comma (","). │ │ │ │ │ │ │ │ │ 0/target_metric,target_value,current_value │ │ │ │ │ │ │ :ref:`watermarks `/metric,interval_us,high,mid,low │ │ │ │ │ │ │ :ref:`filters `/nr_filters - │ │ │ │ │ │ │ │ 0/type,matching,memcg_id + │ │ │ │ │ │ │ │ 0/type,matching,memcg_id,allow │ │ │ │ │ │ │ :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,sz_filter_passed @@ -406,13 +406,14 @@ number (``N``) to the file creates the number of child directories named ``0`` to ``N-1``. Each directory represents each filter. The filters are evaluated in the numeric order. -Each filter directory contains six files, namely ``type``, ``matcing``, -``memcg_path``, ``addr_start``, ``addr_end``, and ``target_idx``. To ``type`` -file, you can write one of five special keywords: ``anon`` for anonymous pages, -``memcg`` for specific memory cgroup, ``young`` for young pages, ``addr`` for -specific address range (an open-ended interval), or ``target`` for specific -DAMON monitoring target filtering. Meaning of the types are same to the -description on the :ref:`design doc `. +Each filter directory contains seven files, namely ``type``, ``matching``, +``allow``, ``memcg_path``, ``addr_start``, ``addr_end``, and ``target_idx``. +To ``type`` file, you can write one of five special keywords: ``anon`` for +anonymous pages, ``memcg`` for specific memory cgroup, ``young`` for young +pages, ``addr`` for specific address range (an open-ended interval), or +``target`` for specific DAMON monitoring target filtering. Meaning of the +types are same to the description on the :ref:`design doc +`. In case of the memory cgroup filtering, you can specify the memory cgroup of the interest by writing the path of the memory cgroup from the cgroups mount @@ -422,25 +423,29 @@ specify the start and end address of the range to ``addr_start`` and you can specify the index of the target between the list of the DAMON context's monitoring targets list to ``target_idx`` file. -You can write ``Y`` or ``N`` to ``matching`` file to filter out pages that does -or does not match to the type, respectively. Then, the scheme's action will -not be applied to the pages that specified to be filtered out. +You can write ``Y`` or ``N`` to ``matching`` file to specify whether the filter +is for memory that matches the ``type``. You can write ``Y`` or ``N`` to +``allow`` file to specify if applying the action to the memory that satisfies +the ``type`` and ``matching`` should be allowed or not. For example, below restricts a DAMOS action to be applied to only non-anonymous pages of all memory cgroups except ``/having_care_already``.:: # echo 2 > nr_filters - # # filter out anonymous pages + # # disallow anonymous pages echo anon > 0/type echo Y > 0/matching + echo N > 0/allow # # further filter out all cgroups except one at '/having_care_already' echo memcg > 1/type echo /having_care_already > 1/memcg_path echo Y > 1/matching + echo N > 1/allow Refer to the :ref:`DAMOS filters design documentation -` for more details including when each of the -filters are supported and differences on stats. +` for more details including how multiple filters +of different ``allow`` works, when each of the filters are supported, and +differences on stats. .. _sysfs_schemes_stats: