From patchwork Thu Dec 26 22:14:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921477 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 2A09DE77188 for ; Thu, 26 Dec 2024 22:15:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 87DBE6B0083; Thu, 26 Dec 2024 17:15:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DC886B0085; Thu, 26 Dec 2024 17:15:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 655C36B0088; Thu, 26 Dec 2024 17:15:03 -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 499DF6B0083 for ; Thu, 26 Dec 2024 17:15:03 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E9747120E69 for ; Thu, 26 Dec 2024 22:15:02 +0000 (UTC) X-FDA: 82938515646.04.DA8A742 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf24.hostedemail.com (Postfix) with ESMTP id C3151180003 for ; Thu, 26 Dec 2024 22:14:55 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aZ+ftHr1; spf=pass (imf24.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=1735251261; a=rsa-sha256; cv=none; b=HOcFBlx8CTC8XOv4zu4DERXXntUESIzNr2uwhzgrn2PuXKjhb7EAvd02qPwvLfyWzvtoYA LIxISwnqwnI8RZhyPKUf2XCgYFJEpAkUSuhAW2gwhAEyv/1LNTwEfKBNC02PfoIW7IAcvA S5aqStU9/Mnzzk9rxG4kcF+a2JlNHbY= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aZ+ftHr1; spf=pass (imf24.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=1735251261; 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=EmZ1Xw+mxIMQURnVRUBr1sZ6X6QaneW36HGmzgSgXFk=; b=sjC40VtOm9uGdUWbRHXxGWLV4QUaRjZt854pdwZFElVVED773v7/EzCqU6ZF7u3q0LOffR TVZjG2/ZqBmpimgQ/7t95WFdMF7pwAOTcw/IWtM+gT+6Q7VZWFHNGWK07tCfSMAdv1gxbl FPviMq17bGZ+xo5EmEq4lostJdrwjEs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 94E945C61EF; Thu, 26 Dec 2024 22:14:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD8D6C4CED3; Thu, 26 Dec 2024 22:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251300; bh=BqfFuozL0F0mxvXeJ3OdZ9G2Y0SIHcS2uBA23Vwog2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZ+ftHr1CkAH5F63FDXtw0/BlvymU//usYo7FSrg35NHQ1sYDG48BuoNLXlHBZcsI hn8XzMUIJRlJZW13Bn6vnDqyHQtTJXKhomujUWTXi3SjjR0YQRGeW7qxs4O4akLgTA eELMnCRHUJ5GlQ0J4b8ds3pHxVNxRopSGsRkr9p9IIIIbSbylGw+uSvbETncTDMQZz 5uH/Da7PfzmNxtiUyvEVNRjehKnEyFLZY3n3DWaGIBjBWga6bW/3z7f8tAPzwtrnSC bMPOiWeRL3btA7IXiJ5xDPRnqZPfN/MBeej8hcQedLut33s1yd2jCAlTlcOpTpJ0ng WYDj6Qh9EfzjQ== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 01/10] mm/damon: fixup damos_filter kernel-doc Date: Thu, 26 Dec 2024 14:14:36 -0800 Message-Id: <20241226221445.78433-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: C3151180003 X-Stat-Signature: jt1uh9otj1zrae47cp1jyqhetoqu8pkd X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1735251295-830500 X-HE-Meta: U2FsdGVkX19nlAFEkp9tRHqTLd78mE2Bo/8MdT6I0amUEoiY4yH1oUVYGbRTynhVHpZMYk/N/BIOjg/6Jwkyo+OL+hpIrgjTHTSb8GK83NsO1zKDi1RQNZiWm+YZIWIatMwBEUcu/v/ZtfZFFpCkoOwzSaS8nzEk88gHHiIqmewOAn8bgKdiAdsAn8jYVUibHeHSCiCLKwWGTgbfHL0TcdI1pO8J2O1wUIU5VrtsFjqIbSjXfvA+NMCwJVftIOsn/p75tuEL6xVmSGjKSafLRRK1mtPrLamIbKx5/chcGdrmxPGT5Z28ICRraBHAbNZBMHZ4eOsZrx5Q7XKpnBYvNMjVaj3I+xO4SnCObeyVlu2O899lvEMK+glGTzaZtVTRbfNiTbwPnK5eBCFhUuhLR9UWGUcyyPHLPtu6DVvP98qJQN/S+1yYJhyxy1EGfuVNpXycPrafqpVmji8rnAsQA3y3qn6yco39lMY5KD5ptJqFUpUGVd//m7XgaKp4+YhfzRNf4JkPMQZutpnZL2vUPJ0BLq44Zy03tINJrFhIGyaE+mVbbkHBtvftnHZ/xoMfy5zzlsdPIpEZGtT6FvDoAXxorXbZfRHmZ9ww5g2EWBMGwoIdgXRW9h6gXV3uWquZ7jOeiHy2dDT7Al7ta1V1cz/OJJK2LV2B578MPtHuLf5VstiUh4wG4m6oQgnf+MiI1HzfqCh2cxTGMofYLT+xscV+59Alze+kFkqhLUK/vMDcFptlHvIi0gKXY3NbDo3TLk1itAp56+rSRZ5KFb8kLXU3+Up36K3FkFE2gK9imo4efB9PZApyhH8SOqpX9DQimH9zClfYyl4bgfygCSpoc+xym+y5h5qB3YyzcqilEkaT/KBVtlEQTKbIVskdNb2WbqjJo/4h42AvFDa/zIN6qn/VqyH9dJ8I4w0P4Zq/9w2Uq1mmtgMjoUAF3TVZo32zLyR3xIhcKEcYEo6Rh8j 0FaKeRHD UXqvtthsfSpJElMIhXtfQhl0YVM5pAm3oW0snZfwsX6diQKGk56GOVZrCfYW+aUm6wXIUzCG3waQz8Ay/LAkQcm6TsJ6e8LSwoFWJDQZHHBtfaTpUwjp5G0j04qI6rLRMiELStDyqjvpMeMkQlJjdx2ebftCmYLQR5SOTe1Ft00fp6Dv2HYdVbBHpehApQDgJMNXn+gMEoBBkRS8/yTkLbbJ0XcYEr41XQm/u0Nw98uRXQHOParpkT4ch4oQ61P6P/zvacqIrcLsbX15b4ytRZwqxbQ== 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 18449b5c45df..15f098372672 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 Dec 26 22:14:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921478 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 1F2E5E7718E for ; Thu, 26 Dec 2024 22:15:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 545E76B0085; Thu, 26 Dec 2024 17:15:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CF3D6B0088; Thu, 26 Dec 2024 17:15:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 321786B0089; Thu, 26 Dec 2024 17:15:04 -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 15EEC6B0085 for ; Thu, 26 Dec 2024 17:15:04 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C15571C74DA for ; Thu, 26 Dec 2024 22:15:03 +0000 (UTC) X-FDA: 82938514008.09.39F46B1 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf25.hostedemail.com (Postfix) with ESMTP id ED5D6A0009 for ; Thu, 26 Dec 2024 22:14:31 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UTFUat3S; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735251282; a=rsa-sha256; cv=none; b=QwuHuXiPcPKA0LNO0uvTA+7rWnPtgYUhIZw3WKdno56lqL8XzmgYbhkNs/4mbk0Twx26RR R9rTv3vWCrgiXo4TJ/gk8ms2rQVpXttT5QpWDGFoWDgod9a+cZvpCpoA7KT4ikSqAYr1OZ H5jU1HjgYlkV2u6vq2Edfbw3YwstfZY= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UTFUat3S; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735251282; 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=Bm4mWiXuMSdBNYU/qjQCTKFEuHAhTLbfTEWNOJoN/a8=; b=Bhzdr/S3LxKfpSQhNnaF+12rrfj557VVkFisf76xZzk9vXgToCvSUXthp6Ql9VvulBHpWx Xh095RCyK3ksQoK3wsoJGr5I8XITd4LxqzOkZHVDwvdNHJh+4gVB4VjSWhv8FC8KbXUr6k S0JU0Hpgg5XqEMYp7rj+usd8/CgvN3s= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 8BDC8A40F32; Thu, 26 Dec 2024 22:13:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6336C4CEDC; Thu, 26 Dec 2024 22:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251301; bh=DCAC3zBpwSlEJOxW64cidA0UEg6r7ucuAwa/fXFsTMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UTFUat3SOgqfEEZJflyn3JCmKPWPiVLSkX5iWTSvS8HbRowJLpHcRXE8CkToU7yng q9LcpJvsRvtAEEM6LOqsAMgcm9JDVwZC7U6E14+p0CwctP/OtYhiwFol5MugS7WPbr n8W+iXE9TRBPEbLOFuiunssyQk65luJPPIEgJyo+b8wxqRIvImB+wxvowRWOF0oqb8 7tJD//H7GqLp0Ez6JbFfOCn6CUcbjxvnCYwg2r7qdYjNWjYRiEDmCrbS+UL8Zd4YxD LZHD95G78KCKjZFmkix0ubtZgugm2mjboK4jSlbhQw5V1q/nHhbgq4b2tZ4tacL6fG yrAsNmCBn7Zgg== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 02/10] mm/damon/core: add damos_filter->pass field Date: Thu, 26 Dec 2024 14:14:37 -0800 Message-Id: <20241226221445.78433-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: ED5D6A0009 X-Stat-Signature: 1k196uadps6jnyquiw9kmfxe4wbi5igj X-HE-Tag: 1735251271-510917 X-HE-Meta: U2FsdGVkX1+Al81LPePGZzIr8UEyo75PqYcZbe/0h0Mh11Y14uGNO0nvv1lR515LJULhP+6mG+Rdlb831hekJgt4nUWf7Qb51INvJT4QK/UlQKM542IQ1SW5uRjN5gQF+SRo6fBeNZ1zMOPIkES/vdo/LjHP2xW7vGlK5KXA1xFaAdbwCyFRMaPtgF7tAlAYU/xNAkl+08LpGvd8STSLVofyknb5fW8lnNVSBxAdTPB+42mznQrusdn+3Iy/015Rxrn8ZKBJ2GWerIRWVF+uzQi59wspCtElUJdTJ/FK2udF63+RTIIr3hjFmfdH2bpDgkMAhAs09GTaV428BSphRD8hAOSv5IfiwfqY9A4SoJHf/GIhngwSsoNKXOxJAsLu/eG/X0dnmn6wAaN1Jg5+YmpdIv0fo8EzaxzN9+NxDXIaYoOIUwxsdcoIuPLlsU0fEXbl6E/uJYsK8oB0MkVVwUUDqWLLR8RAdUAVi1BKGI6cwUEnbKfP3CPqf8NGo5NZKbG8UqerXG/jIallw8S1ndW6BzycsHn4VCBSF903aBzc6DXj/XAMjNNpo3eDTVpJ5ri72Hh28YAiHQkrXBFl3LqAZC/P80B3ALNgtvnC3GbRl5rVMvlAkDzEWMF9Yw+hQbpelGhna+xtfvDFGo08r0L3o07tlKFV8Fl0SYIHwXI4lJJhi/Ybzc0AwS2kB9q0xr7fnTxmnEjLcd4koRNIlBDOozKvrL+UlBlJZWCKdqaaDURSBuPEcNU9GMZZ8dwW6pMPgaPchtJu4WT7ecK6RjaNPwHWBfCXcdVjMITAGQ4v5aPir5hTAw1FH6vWRYF6BdWUvzFgdI37Gx97NoKU+SPaoS+xzKfmqKlnH89C39+5dNQFul5NKAPIxML1W/HryeoiwA0Bc9vcmPt/YOWj8cl5MJzEUWtXrWXEyrmrxUknXeUwaa+fut4N/AYaj3UqaoerW5/obF7JOkGmaGx FEwgC9v2 Q30HD42QiZJsgB2JOMUPPV1nEhhZ8Tn7849XLbjATcoHwui2+6qbAoCeP53fKa5hs0gVPCXy07oKS88WeHk+JtWkX2zGZdrXEes9aSKxSWKX/YPho57X5kGHgOXeJLFdTXe5MjLErqa8Rqn4KbNxO1ocT5qy+a9FLeFvKkjLTsKXN9PYMiXQQObjyN2uLpC9pjepQZnuceW7RNVQV+xy1dw/63QlPRz4UMuDNvGHQjUJgz9rWe+j7m/xf6KkmPL57Q/4kjuZcSXpy1c383ScK3SSMjw== 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 (block) filters. This makes it easy to be confused, and restrictive at combining multiple filters for various types of memory. To extend DAMOS filters for inclusion behavior, add a filed to damos_filter. Following commits will make the field to decide whether the filter should work as an exclusive (block) filter, or an inclusive (pass) filter. 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 15f098372672..122c30e4ce19 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. + * @pass: Whether the memory should pass-through the filter. * @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 pass; 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..e54bd19d6f06 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->pass = false; INIT_LIST_HEAD(&filter->list); return filter; } From patchwork Thu Dec 26 22:14:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921479 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 88130E77188 for ; Thu, 26 Dec 2024 22:15:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A65C6B0089; Thu, 26 Dec 2024 17:15:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 63BEE6B008C; Thu, 26 Dec 2024 17:15:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45DDA6B008A; Thu, 26 Dec 2024 17:15:05 -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 278416B0088 for ; Thu, 26 Dec 2024 17:15:05 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CEF161C7D97 for ; Thu, 26 Dec 2024 22:15:04 +0000 (UTC) X-FDA: 82938515226.23.3717676 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf08.hostedemail.com (Postfix) with ESMTP id 100AC160009 for ; Thu, 26 Dec 2024 22:14:34 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Z9IcquRo; spf=pass (imf08.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=1735251274; 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=frNekgzakA7P0slnUDi6pxmpA7yyqEk+HqIMvaMEJjw=; b=QjEe6C0+d6KrZ3RrpNolfPc4r0Ow7ijUBsSTnw7xQuQo07vpKSuDJrxL99/xtA2eLcjcMc lj5YQzVg3TheclgPthUtDbo1GTMBxEgCm6v8jzsNJ4UwjlsfbUGTbUqWFpKl9hSn2gFGg0 Bk5o0v06mvdycBjyw2GQgrNFH7Ajf24= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Z9IcquRo; spf=pass (imf08.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=1735251274; a=rsa-sha256; cv=none; b=D8lWOlGQ5LMH1tUlez1AuwAhNklZ+oiq668JkBSWCBSJm/LeT26GMmmrdjN14NfE/+Er44 R5VIby/42Xf1LcRjVqTJ+pbzg4qrXemaFk2UAkIkZAaUuEOuy7jAS7YWpXVyL547Z1AE9f TOwvVrMgCljx+sr2iu7aSNfW0mX4kxI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AD83B5C6205; Thu, 26 Dec 2024 22:14:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0557DC4CEE0; Thu, 26 Dec 2024 22:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251302; bh=8lAFL71XcvweH0oiSZgfTeKqV2YhADAZUO4RhEVof+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z9IcquRomrqtfrXinUoNaq9+LqgDLr3RafzI/eSAraalwzMf6S7fnPCgPAl5KxSFw zsy+A0+Lm/+DNxEl1afKWgykWPImxukIdQbwmZrIaOVNqmkekNg+PrRtZa3NB09Bo4 dkkUjqXopVWZuXiesXbcCrfoVIDtX/vEtdmG1Qv3TO8cgEz5GG+AFAMDYUqDo/39AM q5X04z4lqWR+cqzPaEqYKmJPkvF+FBDIAuwvhSoghnIpb35DoI48ewPfAtnXIwaZbO 78on1CmjcqmTiT9gA90Lgk8Q6EzNCuxGWCkduYpYcP4+n0dmibxe7Nwul8pTFb1KWK StPoR5Bi2E2ZA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 03/10] mm/damon/core: support damos_filter->pass Date: Thu, 26 Dec 2024 14:14:38 -0800 Message-Id: <20241226221445.78433-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Stat-Signature: ho1rkzaug7iif6sq8cjjtj5ukthkx64g X-Rspamd-Queue-Id: 100AC160009 X-Rspam-User: X-HE-Tag: 1735251274-736555 X-HE-Meta: U2FsdGVkX18EJqwh5UIO0Wch8jVV1LBfbQxQiKRbrW9fK9sSoWCblTpY72qMAVKXBtcLyw/61G3qHmeXgzrvrtm+eO7YeZQofCDWfzUk8pLnhibbEbvv5/hJdK2Ujn7XZT0bdklWJ1n0rDjH2zm8hQzavDpUJr2+//Er2MXPvEUZ4c7/B9q2tw6vA0Xej32IWDkf5JRTrtpIc7CWv+sVSAjDaCagVuwAgmEex7y34hd6g2na3Bv0LNb61oHB3iJtUU/PvGmnkzsI4c3eizoCOY8kfD0Jop7PxvQYnKshuFXs+GDbBccN1we5wOk5dmWzuz5mUq7KGLKkwhNkuqMD0JaC1RxZ5I5KWkLRlAw+g2P2h5ckX2RUFC0LOK+nYt3fdNFbJ7igUUn2ZIujfcW45LVFBZQyfNj1GiPQheqECR2+C7dmNsKUNHcOEn3V83/iNe8xUM8QefvdAzerQuNqdcB8IqTzIOSyXEYxjbxImi7nBg8jD+7OR/ES+lK4f4pwcYW785JNQEbbufyakdMjaBb1v8JZShzpumRthGtheZ9kviL87fn6zVU53/a9hbLNq4exbZuKYrkYpW/bmqzNUIKHJJPJDQIZak1m5s/4n7tjk8viaeLB7PR2IzA/D+kw7IAOPXCTcrvjdTi1Gt5upl3gi2XQT3trJ9grrvVxmM7MO48G2zgUB5Xtb9yCikBZuEkQJSsYBN13ce5yZ1LRPGDnzfGjtPVMJ6WPHyA/8QcqQqejoHqklk6+KoqnXsFA68hobN1wNCQZUoiY5EFJoX+kUrGKLe1g5gjaehDVz8B6I61G/bY3flMLl2R2RoLYO2eYedP30qx9mtUzK/vPRbvsZThYMecm+3Aefp6wptyKxs3EtLN2RmHcJMOLn2Xw3NLlXf6hHrn4TkLS6LCvFQ2PYyLz3V/jtmGvDvtGSMwW2fh0jarY/iFDhkq9asqeMAV+jxSo3PeueR7atsd C/dsqaup Avn/GXmd18HsS9u9ANNJffTQ6ypfJdKufNG7Maa0neH4FBTkB126RScf81arHNdb8Pz63BU1igc9+thW94BMQ5X/Kace2Ay6Ojgh0pvdvGL6T9JoD/M5rnyI8Azcni/HOMSVQ1oGM+Wt9PxefUpttnvm/zy1MtkWEWJ44KJmcpAmB8ZpZ2WCNmLux9F6xZoDGsuM78nYS9KwfCpbUzmbD3BliXkoECs6jL5OFcEgVhcNejMNDjzV5VOrOD4BXlCTNhYqrRBef/46vxZTr/BrZauS92A== 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 core logic is ignoring damos_filter->pass by assuming the value will be false. Respect it by dropping the assumption and reading the field when making the decision to whether filter out or in a region. Note that DAMOS action can be applied to any memory if no filter is installed, and DAMOS filters work only for memory that satisfies the 'type' and 'matching'. Hence installing pass filters without any block filter after them makes no filter-behavioral change. 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 e54bd19d6f06..71db2c754e6d 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->pass; } 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 Dec 26 22:14:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921480 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 D9EB6E7718F for ; Thu, 26 Dec 2024 22:15:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 483FB6B008A; Thu, 26 Dec 2024 17:15:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BFE86B008C; Thu, 26 Dec 2024 17:15:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2371B6B0092; Thu, 26 Dec 2024 17:15:06 -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 EC4F76B008A for ; Thu, 26 Dec 2024 17:15:05 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A96AA1A01D6 for ; Thu, 26 Dec 2024 22:15:05 +0000 (UTC) X-FDA: 82938515352.22.6B9AB48 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 61AA740006 for ; Thu, 26 Dec 2024 22:14:18 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fQElKYiZ; 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=1735251276; 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=xQLQDjrGB+WuBOLu6rdAwhwOePsavoz8t4Zp4W9qHdc=; b=TFMyi2NLnOrXS5V6MyUsqe+xnjhzXq8zMDdZoWdj+PrBXmri0MzeaBr7pq7YkJCL4/vNiG te4P21/Jlf24oxd9Po4v0gKMGah4GgTaIX2fv2px9K0ivivRyhU6ZwiwaIuIuoKXK2pOkq 40VODuySVm2H2ew57lTrLDtd/xjXPvU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735251276; a=rsa-sha256; cv=none; b=Q7qBUGXCePbZoVD49jv0bPg4OXGZ0sHRLeahF9YkbCdYxqs2CeJQalUuFrbvZstoBOEAW8 ouLGlVYlEvk8K5QUb7Lt2vp9pEoYVg8/bTs398eGLijK6C2ooxUJKRsHyiJs53HVTt/pOg 7fxZCg9qTIVvzkt/IYtUbZZWpyYAe00= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fQElKYiZ; 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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B9A7F5C6207; Thu, 26 Dec 2024 22:14:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1503EC4CED3; Thu, 26 Dec 2024 22:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251303; bh=SeMHzC1M39t8q6CCCk8soRnhB4lB7Sy3qIRyk7EYfrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQElKYiZrPg10ZTDGDGyOYXrYb40QGFH1A9Y1Nu+H2xaepgLZrm/1KOAOPnpknTJM SmP9DEpnyiJ+XJFxdT2OadsMaV1fnfgO8i3WagP7Qr0nZpl3nn7xrUrhx9qlzPxeGr 1iltpyUwvAxgkY4reWZBID4op2SRkyO1WWlfWo2ZPYrLAFgoVFeIgkR6dbA5Fqr6Mj DgfSG3uP2K5EiMtRjSqSKmzOSubKrTR6wIVrFRfpneJTvThwlTFHlpEBX8HuwrmUPr zPCPzDUo18dVoUrPk3dcUE0DO3ub++l8qwhumfRJsKly23bi683QmfcyQDauxw5AXz HuVVFKKHEfaVA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 04/10] mm/damon/paddr: support damos_filter->pass Date: Thu, 26 Dec 2024 14:14:39 -0800 Message-Id: <20241226221445.78433-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 61AA740006 X-Stat-Signature: t7shf47ozwyfsb8ed7msi3km79ny573t X-Rspam-User: X-HE-Tag: 1735251258-156395 X-HE-Meta: U2FsdGVkX19lmo1GCiKRhq3yKGtkKZ7a1ydjD5ycCVKjQr87mLLv6IJDXpBhJUFEIrNuWggr1dqIiKLYPJ83FCRCfszwyBYYlWX6JXkho/PZLUqP5SAmJiq5ayPMctB3go0vnp4zx3tUf2p8iouREy4BcnxbUbq+q3vSrKYPb0tlUtk1XEDykRuCV4pNfWtgOyCjDrUWuqM//G6aUkAWAgktdFNvc1x9D2HBxVC/a1YdarlWFpnsJEgvWxv6XpLjPffg2QPBrgAUWBru+Wv1GZSmRuUs0NrXTOeTyW5BpINGNPwLbGfwCcwKjoIyJ/Mq9V7eeTd/Y8GLjU8giCDXOnNnrDDRbl3VxgYC+elc47VKkXtQ8SFlEMHHLYP4WwlUMJJzzrW0Cufpr2v+6JJxUU1RBJ/WqBg+qFMes7Lg8m/heiBuqTu9ztzwy0GP5hsikpPwh1GWaTv8SoFhkpnzalgibyRV24VkGOaavwdJj4c2zkt2/XXcLkMZHPAeqaqGJH5dYwlSm3GXuHdyJnIKjvLDVF71EBL4W3FDiTYFDujcMTjrmVVkWZGDUuT+XANR+ZWfB8vgoT01CwEZg/ugrbvZzQZ0D6sjyCSQGT0F5f3G1mkVD0czNYM2h+HlAp6wy5T34RiMhgZ6ThMG/+eaRx0zuKs44i5MQ4+PYQ1/WcLc4M8gRyhtFNTVmE0N1jurzVTJBPGbWOac2rTI5Mi2RxlJXHnRu/8OhX3Giim8gTteXxe9X/4HXqaSO5ZM+efVZcvJP0hKaXag2WA6WShcPMQ6Xy8BBCttco7009Mt5Sb1nw5uaLS/TTolLXWbCprAPq3q/D8HyuHj1Y58AsWgYeJo37X8OBUcurhhdZ203i5cDJQhK5rWtoDPlkUkIbA2LlJRSZBLTasID8BaoVhm459ir+kVe02plpwSpgtT/afcY8R5WMfbmOtQpnAzFnxmsgOf1YWkbbeAmhhE+24 zq8Z4WtH FG/ZTjDkYwcj7uVUFr6cjThnsxHTJx2+BYZEKzc+xjL+pooQhqKAF/ikF9Xc0erJnIzmpxIXTOcY3DhnnKk1Nsw5dxx1sDQ1GKfZwj3NGcpt+yP04FTil2Iyym9UMCUDx/RlA34N5yiMLyfS7bCtb7qP9FrwkIeQ+Td3YBY1cfsoRUHG57NQXuUzWV2jDdeAG3LeRyPEPpbH/poP+k3JIVIy6RY4VaLoty5/xl1mbgDkz3Ulw5TT0MGS2XRmac+HZ9SO3PYyCXVhMqh1yi/abVabpZA== 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: 'paddr', a DAMON operations set implementation for the physical address space supports a few types of DAMOS filters (anon, memcg and young), but ignoring the ->pass field. Update the logic to support the behavior. 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..71cb02128b46 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->pass; } return false; } From patchwork Thu Dec 26 22:14:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921481 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 3A63FE7718E for ; Thu, 26 Dec 2024 22:15:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4848C6B008C; Thu, 26 Dec 2024 17:15:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E8096B0092; Thu, 26 Dec 2024 17:15:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1ECD76B0093; Thu, 26 Dec 2024 17:15:07 -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 E9ACA6B008C for ; Thu, 26 Dec 2024 17:15:06 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 985D7805FD for ; Thu, 26 Dec 2024 22:15:06 +0000 (UTC) X-FDA: 82938515394.12.DCACB98 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf08.hostedemail.com (Postfix) with ESMTP id E2D34160016 for ; Thu, 26 Dec 2024 22:14:36 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HsdVucsV; spf=pass (imf08.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=1735251265; a=rsa-sha256; cv=none; b=7sTLeVJJMzyPSdA3dLfRUTtNadLBIx9Q6OMNDTYBleznAi7X6/p6fT0wwS9rc8jX+Qon6K tMYn+mzsuXeQt5GC87BazUTIlV1Jqt9Xbmftns+FqaNWjsKvcwIRC8WkuglzvpxR9a9P07 xCs0tZ/8SAsWUvg2dxbEibEXhXtkCpU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HsdVucsV; spf=pass (imf08.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=1735251265; 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=acEuFLeEFiA7OWxLPpKr8mqfrk0T8xKBw99KigAOUYw=; b=tDkPHG0VLdNvwBjXD8q7Rc9vfsifypVu3+SOu4WCWRdOpaM4/zlIFI/4vcttQ0KDUYkHBz AiR0cMUfphOfeJY6Hg15Q0lQe/ltpjz0GqAPZGiMZ1avHhIyb7tqEkDV+oduasLdOCheth 5B6AYgAS/2EQXWwNVnxJ7+chi7gfoCY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 95360A40F35; Thu, 26 Dec 2024 22:13:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22AC5C4CEDD; Thu, 26 Dec 2024 22:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251304; bh=xPDKx+cgGKS4vL2pTXGyaq2E/e6yLYc/uyg/ecrFVG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HsdVucsV8Wau5wOaeCDCDIUEIxj140sC2qCi314hJXw9NQSbgGwj80fp7tQAft9vO FyiLvn1wUUepP3anXtz8n+hsHp1zruw76xWlrUMqR9EWFGXkWTGGAQcVzhgcJ98XYq rbEKcYuplAYaD3mt0knO7evq+zCwUUJu0Vwq7+ozUKo/L5h4jPcR18+bo3q47yE2Pj DoLdhzRHoPVAwVzgK2/r5I6O5wF+l/YcYL9Ot7tutCoh3Q4Dblcgv4J/ly7U3pDE3U 8khMFW39XMka8uPqzIq9oExKuWSQ5I5qoF6Jwf0BfLKvW8DtHeo9WKGsvClh7EU+Un tPoPa5rI5ZfjQ== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 05/10] mm/damon: add pass argument to damos_new_filter() Date: Thu, 26 Dec 2024 14:14:40 -0800 Message-Id: <20241226221445.78433-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E2D34160016 X-Stat-Signature: r4hsx6b6ab9ow7m8gmy8k93xwbbgb8uy X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1735251276-924317 X-HE-Meta: U2FsdGVkX1/uBmxGiiP2k1osf/IAq9sBQZyvKimQjg8zCk2N7BCoARR0GlyYNSYx3K7HV9ABvmLzyufnt8Ym/2UK33dJLvLXEUGM8FjuY2xfXW6WChuCNBlJpxdiEPINHAnERTWChQMEYlDLx/Vmk1IQQOVXw+1ce5Uid3ILLp7H4eXvfoVO13+4ITuKzQIG5ouakUUzj7wT6zXBGRPXigQDw3C+4MTeMDQ6rnc28oWSsPmrd5z3It2w0H1PDDEfOQqIS0Cn6XuMoLYO1bJnI8UTWSc9huoSaypwYI/GJz+QSCDesXVVDzwbpNhoCqpyNh4Ikz4/WpnS2tYTNwRl54fLEM5d0i6mYisdZqty70mIZFPJgjitYTGnCJadg2kf5r+8cT7UbpXaH5g3U7DmcQNsCqgmyZkRe32CnEbZACe+grBtKIPzrC5C2gSc5lmJYAOAUyLhTanWQPTu3UB7q/Yiy7mESAwHe9PCWF0PTiIzfYJWfTxfYmTL9lFl35RKKze2l33KHLfQVVhYJasfeEKe9p2YIePXrpqz6zuvQuXPGLelzTzhwHMFhYpMsVTtBfr/XYVGq3sGkj299FMlQcQ4SoU08cA9XJtth+fWR4CEN3ZsudDGr+ztYYdwZwMBXkS8rdh+u8EygzKXaUu8UwgUbkfR+mi+1JQWUAlbkWggKF13cqZ81QsSAWMNb+OJvzJ4y6EybFz4qYUq2sI1ertqa4cd7nCG05dJjilbrhwfx12Xf8dpkjWeImqM2X+JGqSGBQotEROR+v0pQjtdvTpbCzHVO9PvOgDdH2ryzYJoE5F5hWROrImroYhLs1wyNaSF0E8WkmUv7+o1Ff2YX85ATngPm71nGayZqaje5cAWMQIGQlx7GxzbSPbYihaW8Kf90+9Iyj0BvxN99eGL51U9d4X5dhEwUBUht8cvRE4HPbZMwbLpavMNWN6PtdVEk8ed+Sr7NDXuwiIVZCl llGStWCQ iHjgICslUqs4Ljk6gqor9JxIcKWiLwVQxfdy25GV+Q3cHIWst9W+yog/MuFFlMOWeN06Qz/qNQgQg9XBeWizsRbhEgf+tiH/7zqT/1g9kuK+imeNMfc3qrMtHuS+JbmcSqili5OJXxarzqepe6PgVaQi7J1cBH2pRUAniXZ2RNzKKY1fK2AG6MrJnXthE1wkG6A0YodYNN7qjZFm9jj9mQqIpDehWYu7T+BwIUuT7dDsbfFlovNSrBoVtE4taA3ZymTXLULIoLLuG3F4MwgImvLlkyw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000039, 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_new_filter() sets damos_filter->pass as false always. The API users hence should manually set the field to use the filter as a pass filter. 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 122c30e4ce19..ad0360711aca 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 pass); 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 71db2c754e6d..13f12d82de5f 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 pass) { 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->pass = false; + filter->pass = pass; 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->pass); 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 71cb02128b46..cd89500efc22 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 Dec 26 22:14:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921482 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 7E7F3E77188 for ; Thu, 26 Dec 2024 22:15:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 462736B0092; Thu, 26 Dec 2024 17:15:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 36EFE6B0095; Thu, 26 Dec 2024 17:15:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 175AE6B0096; Thu, 26 Dec 2024 17:15:08 -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 D9C326B0092 for ; Thu, 26 Dec 2024 17:15:07 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 95BEAB0BEB for ; Thu, 26 Dec 2024 22:15:07 +0000 (UTC) X-FDA: 82938515394.26.66A1C8B Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf20.hostedemail.com (Postfix) with ESMTP id 576091C000B for ; Thu, 26 Dec 2024 22:14:22 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=B9hDwO1E; 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=1735251277; 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=kOSEhbHM51306icv78I717UU8N7Q1eIVUCIdSs5umFQ=; b=bmi5we1ouS1hqL7AyFeuZC8ctS3cBBbIdBq8+JFOc2mjbLEnfa/J1dmXAM/gtop5T+Hmis /lLNMkDIGGQhC2E8XKeRxfvwZ07J5JdSgH4nC5uc1gImjy3wnmYk//WuB7E6WVWyQllc3H 9N9VlxbVqIzYox0jEcfKNlwVYv2eEiM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735251277; a=rsa-sha256; cv=none; b=w6zwCPJ3rWCCWHGE93D1dZDgBs3qQP4PhXEM1UF5b4ZCrO2SkP3QxXQ2j9b314Uxmn6HCK n83d5OTU6GjxRj+d6oZiwhi5OLC1Hx7fUW70AgOP/vVdpoBt1Wb2Jx94+bzZT4wXQ4kpmM ihlGbsBVXmImKoiYGCswpTDC8AzScAs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=B9hDwO1E; 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 AF66CA40F4B; Thu, 26 Dec 2024 22:13:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37E88C4CED1; Thu, 26 Dec 2024 22:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251305; bh=ZERQXRIpbhEDVEpD6J6LgTdFsTQpbeeZuCqI48fC6sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B9hDwO1ET56DJbfUvA1NkwrMAmS4uGKkC/pY+lnPyDmXlFzZblsZPOf/hRnvjug2D Ijv/xdiTSf31U6r5mgZI+BBwJ1GgfipaG4Y1gOwChrjrnck9kcooqb522+Q1WRRJW8 6eGsDotNEvfM9quAQC1lcy/iuYXEjpfPRimjwTcBCFiGcfw0ZH+sl8vf7orfi+xnmv 6eQ9M3oA52KByjBcgcZmWHa1dni6RtyulWyT/RC9EOB/cJ5n9LMBE+u7n+wp6Frr4z zlfg3TPUFFZU00E4AWCp8Ikpg1SP/bwQTc38d5oWrfVgxHX+f4qxL4HSaSIhYk/PSU 1JGgegHMZXyrA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 06/10] mm/damon/sysfs-schemes: add a file for setting damos_filter->pass Date: Thu, 26 Dec 2024 14:14:41 -0800 Message-Id: <20241226221445.78433-7-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 576091C000B X-Stat-Signature: 74osutruzgctoo9qyeoeaxog4qmhfddd X-Rspam-User: X-HE-Tag: 1735251262-6605 X-HE-Meta: U2FsdGVkX18XJ2aUeu6dIHG+rlQDt7dUzFFEXJ3Zrb+j1FNObMTOxnLzgG4TUT3Jvvla7nvahIf5ngi1NvaLPjrdQobDWstVduJmUxXcku9sWmKsWtO6EUR/xC9pM7BWpijB6kn81Q4nEmvE6QK8TVXuBPmEzCqG44HGXCgNJx57iLbb3y+N0fQqM3Cx68u0Xpier2K1wgI85w5p9EBoF2wSQyFBnUNIJBcAcVSl9a6pBR197L1k4a2oAyp5VR41qtb3cwGsdcIDyyBNW1d0Jim9OqbCNat/1x+BHljmUmhvMtVNBuKX4EAI1OUeyHmy07dvvSRLCLRGndJqnoKJDgMn5zWzPYzcPbAEpuDTC00SV3b8kA7BmQAF7UO8gO6NBh7flHZLBF3arpiUS0EDsIQgPeAkSiKMnbaqc9PMQ09J8SVF9AXV6+81dGxQ9HWjSqCunL/g03V4GNAXwnBj7ZtXAjgY4B+DlIWRFK8aRSbQmkmC7kezuxG478Ar7FU8WrFCxRZMX1OC0K29kNrz/hBfVoH0/d92nvJGhfWUVM7uvuMiJc6E6S1nF1Ho2M3PoiJ5lRS1PWsiiadQPDlqlzhu6msY4uQr7Iur+iMdUvOZZuzCQESgS9RqKprF45d0LP5450HKQ8ssZYzKRCy1GGPxTZdbIzgKHVWGDPJ6zv9SajaSldo0EVGOUK/shJGIKYtUD+MqWVyliWs6V71tTv6OiXK66kBAtXNQAd1Bth5ZUkT92un8H/l6ZpFAB/wheDZ7HCu6HRrniSgPW/GB1z4sg1lAoFLQk5eQbMwDnTDL1SxhMvM4eyFippxLStafM+RgQqaUTtjqmu9/9T3vQwEUIZCraylkn6Iz4h7ncjdRHYXfCXHtj3sOHIlZliJijSiomYykSCkJr3WDtNa5h6XyK1GN85h2q+1mG1fQs1RriFOURMQvlqjr6lnegF75dXpFYp9Z41Nzs3q/nLw kRDFImyJ Ot2TfUXIcfafjoUuWauL0t3na3ybtVWnJeaqDUeMJAO/q5rfvAVG7sLTrSEWy1fFiiIh+Yj/ITFRN5eyVBF2XfbdvRa86wS9IXvgrFoLJyk4vnPQ+DPh1BoVN/O05Y023r3/p4+zXOnsInX6zCOrKThVu0k2j1FqCfL/mvVtaUEat/uwcDTyhyT6U11XyOFeKD+jsVsTWxXH8uqoagjNZl8P7+R1QMFd9HyHYJ1QrYun2j7zItHbjw2I45lRrS++8wv90TUihl1y7LFeaHXW/27zM4g== 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 'pass' 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..9e171046ee94 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 pass; 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 pass_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->pass ? 'Y' : 'N'); +} + +static ssize_t pass_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 pass; + int err = kstrtobool(buf, &pass); + + if (err) + return err; + + filter->pass = pass; + 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_pass_attr = + __ATTR_RW_MODE(pass, 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_pass_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->pass); int err; if (!filter) From patchwork Thu Dec 26 22:14:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921483 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 C4BFCE7718F for ; Thu, 26 Dec 2024 22:15:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0A856B0096; Thu, 26 Dec 2024 17:15:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E98306B0098; Thu, 26 Dec 2024 17:15:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE5ED6B0099; Thu, 26 Dec 2024 17:15:09 -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 ADA4B6B0096 for ; Thu, 26 Dec 2024 17:15:09 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 391A21C8008 for ; Thu, 26 Dec 2024 22:15:09 +0000 (UTC) X-FDA: 82938515772.05.6FA36A9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id E916B120002 for ; Thu, 26 Dec 2024 22:14:07 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="rp1/LE7w"; 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=1735251275; 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=wqJke7qJiKTI8m1mcvLafdQ1PXo7k9NpC2wdZtaWqgI=; b=nATSwRFhkNVA0AlevA+9QNLFitkglVPJGhYKqDmcEC9X5R77W7soauxkCAKLwUoayESLtk vQGph909zx4lHrV+U2/SOZxJk4nzEoOt+mrCgagzdHp4Ws5ySoHIoD7hb/FAhuggmCXg4A l77BR2udmaK5xwOUY59cCQXinD7YlT8= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="rp1/LE7w"; 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735251275; a=rsa-sha256; cv=none; b=Bqnvcy3S5hoBnHOfXu2yJUesATzlytKl4dqkumzC9gmocnjHcWRwzsUYmNPzL2ofp/00V8 3D3FUYjd1uPPNpoTa8Na2hTlhlK+OhanUKGps0y0/UIRZEj7dxszR81+/3HxVlqFor5vIA xN90tHNlE4KhD3I3iIrBNyrc+vGAsNA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 28CEA5C6215; Thu, 26 Dec 2024 22:14:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5282AC4CEDC; Thu, 26 Dec 2024 22:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251306; bh=//vhFtbVl0HM6He0HK/Z+ZVxsC9xYIvf1nEXj2Zge2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rp1/LE7wL75YYPfqE6SY8gZNoaSFeZEa7VCvo/p2eTd0835XsUSEdUd72yQOjrOqv VpSJXimUnRRGeWrvbBQxqWXKAprKqYpFlTiGYm8Ut41GFZiEymEFh1RSnJNLyeCOtm LPo3Nz8X5PR+wBLZQHV5syAt1hTIpXz4a9GqmrLARSD5ZPqV5Bcl5hrl5wtGQJxVDQ 8EDKNtOiHzdjP3TC62fpO9VGP9c3vh/rGSJpqj0yTsq9OqJkS53vSq4CFlafKNHv86 BQ4HUUWEQK2+GO87ss3pG5IAd/CR+8BBeHYYBHXLNW2+c2bsxXKqOiQlhERn7hJnZ5 sV/wL+qtF8bWA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 07/10] Docs/mm/damon/design: document pass/block filters behaviors Date: Thu, 26 Dec 2024 14:14:42 -0800 Message-Id: <20241226221445.78433-8-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E916B120002 X-Rspamd-Server: rspam12 X-Stat-Signature: xdpffz38jf43zzc99133bob5o3uhpjdb X-Rspam-User: X-HE-Tag: 1735251247-333782 X-HE-Meta: U2FsdGVkX18O5gpJ73jIetGUqDiHF8Gl7pT7Rmn5aAwXt60/wynDO3jEHt+c/0Ki9QjmM0ifrZl1j6HOmmZFZnlmrh/3ZmjZ7eUDyL3yLKHKMzJhV3LzQ85uivQbjLrOYdS5ri76cu4udOt0dTBCT1OPxufH/r2srd6wYkgMPMGu5z29ULcxhKiomROO8/FBUt1mAkF5y8ppFIJoRMo2w7tJEJpmaw/F847XAzh563I4N5hIYcijQI0o7HHEx1v+ah5evc6Gfwl+A33rYfBk/CdfNWM3dyD1BKIDiJsOZeeGp6kpgx6xwzd6Y1R0OLlZ17QXV/uSTiSQDMEj38KGRqoBwwrHPy4wcGsJ1zUmCkgRakaku7vWPIfMYGtD5CzJQa1QFHlZUbZB5vImh1Pwjtb+f9lcsmL2K/7bS8fdJatvJGpZwad7buykejuyIOKzBYZGL4qeFGUWzd7lVE1GWfFH/1I89afte5N6NfqTzGor0UJKjwoFmEug0oiv1w+RYqSgWayONkQt3zj1q/e7FVxeR43OvcQE9y6JIOUMgnzpziwOQHQmfa3joVIzgGBW983WGnOh3+MXV6DCaEVmYVKnLwtE9oUqQYrRrZ3mdeEcwnQ1vKoEm6UFodbqK6dnYL79DcwgaVZFtShhXN4SJr91cVaCyLcH1lXiyQbAxJKzq6rbDxt/Yg51oUG6tNjsvHFom86l2tWcWO5+0IXnQK7W+c9kf/LBxq40/SUu7zuMH3ClvqpiZCXABTwY1eqdm9wF3a8MZOFmv+SmNC9U8YWgeWDiU+dw7EK6mDE8jxk4baiuf/YxtUvW8IybpVQqkzXqqE9hkuPik+ckX5aguuOU9IxxOik7SmgCCTVAhnDItZ6GQZs7JlHOEQj8/egpKTYY9aG4ZOC4Hb11kbhGp0U2E8cDpGA6h3fzNpHBxjIWeIdd0BmuPJ0OW9UZRepaqrmPz8fe+hacd6ZvAsN ajbwfeHc pNEzVXemh8zoOo+2mC7XyfhfqiAORzTQCMgzV7FXdrqvDgzZwjKPg//vAtAQVPlwqWaFyxtejdHKhj8PBIA86JEP+48bq852Yfip22NxTNU2fYtOmWt17T19Bjl7EJgkwHAwveBoT7AvreHuB0yHjGYUXZRMc4emgcVNmUsukABOUVnREywQBZoqR7FPCl195WRFYWyeUY/q/DylBWKOjM049zvye4K3w4pjUZyKee8ibRYA= 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 pass/block behavior of filters. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 5ebb572d0999..0265aaef2544 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -504,9 +504,30 @@ 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 (pass through the filter) or reject (block) applying + the scheme's action to the memory (``pass``). + +When multiple filters are installed, each filter is applied in the installed +order. If a memory is matched to one of the filter, followup filters are +ignored. For example, let's assume a filter for passing anonymous pages and +another filter for blocking 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, since it matches with the first filter. On the other hand, if a page of +the region is a non-anonymous page, the scheme's action will be applied only if +the page is young, since the second filter is also applied. + +Note that DAMOS action is eligible to be applied to any memory that satisfies +other conditions if no filter is isntalled. Meanwhile, DAMOS filters work for +only memory that satisfies ``type`` and ``matching``. It means installing only +pass filters is same to installing no filter, because pass filters dont' block +memory of type that not specified to pass. For any use case, at least one +block filter should be installed as the last one. 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 +537,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 Dec 26 22:14:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921484 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 3F740E7718E for ; Thu, 26 Dec 2024 22:15:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DD3D6B0098; Thu, 26 Dec 2024 17:15:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 878766B0099; Thu, 26 Dec 2024 17:15:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F1DC6B009A; Thu, 26 Dec 2024 17:15:10 -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 43FF46B0098 for ; Thu, 26 Dec 2024 17:15:10 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 00B06C1244 for ; Thu, 26 Dec 2024 22:15:09 +0000 (UTC) X-FDA: 82938513798.17.62E402D Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf02.hostedemail.com (Postfix) with ESMTP id 924ED80006 for ; Thu, 26 Dec 2024 22:13:47 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XPjBLf78; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735251288; a=rsa-sha256; cv=none; b=sQnxUoEW6M/geC+J4cq7NF9RO7OM8/Rchq2MkrYLVz+tNuMNm2F+mI+hXF5YwNfokM78GR vofvm7mnVpyISHaR3FBAKN0BH6JWALbDwNP7OinmhKeXTKVN1Su3GyW7o7pbf3R326PBRb 2MVrS1c+SWAZDDdIPRQES5P7ynh3dBU= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XPjBLf78; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735251288; 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=JJ06T9O9U24aN5XM8EoaxdrXSk67OuwjY67lLlEgiBA=; b=K0Ushs1ZU40hVIqGL12SVaZrXqoOUSQCVbdyPHXVM+/twLYWWnMuN2k6ty8rxn9EkOeuBd Wmil2/JSFKXE8zpGxFhok91Gq1xqSTwATQrzi60pjueWoJZf49qj3MkBOgoy9KuzxGHQi6 fpbuTTS3/BU1KDuAOeFEGvY71IiItCw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 09A2FA40F09; Thu, 26 Dec 2024 22:13:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 606DAC4CED7; Thu, 26 Dec 2024 22:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251307; bh=juadYvUhIrNs11RvqR4w499ufNXf6y5+YZmNZP0gQvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XPjBLf782yiUQxV2UcpxQo/O1rKLu/pFbXb6x9/ZcwmcuKgjOG7I6FXRA0xZk4Ybj kKG+IjAweuFkwEF5Z6HZ0LVqUIoLMimFNaifeydwejNdTM8QTXSbic+d+l8J2LzYLI hjudt0QdHdzdDnUebPTTI5M2T1wZvKXQaxgrz1TbyXHRla/A240QKzG9rjG/+u/1xW veiSb2ae+BsAf6V5tJsYWbcZbwioj3pxZWvKLLKPCviv72FYPML2noi9I6ol4jTc52 cZx+4iTwcjn7UxHNRDK0ZzlI+Ke2jTodLo2g0YX8Ux5qoX8hxJtFTtQfjAvBPCv4Fx gfm8JGYr87gnQ== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 08/10] Docs/ABI/damon: document DAMOS filter pass sysfs file Date: Thu, 26 Dec 2024 14:14:43 -0800 Message-Id: <20241226221445.78433-9-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 924ED80006 X-Stat-Signature: mmyy9yjs1temj3hztf94hwcqisaxfnif X-HE-Tag: 1735251227-931755 X-HE-Meta: U2FsdGVkX18RCT9R5+g/L9owLMb9rrmXZK01sQdl+KAgYQke2r4lxFmEMsq3USJ6VnneoC25Wb5srI+cxCULlfL+64TYMGJe/PEuI/9RTDG6Lqw+heZYsdMHKhXFa7gH3pfhvV0cPsGw+pYXsI0z+wR6KWJIhgwr57gjmYTcZaZfdfRHnxACY3tI4Wqk0cAG5+IORnYJo4BirLwoRkWE5JvzR6PpsILZVujREtEZnuW17Wlsu3pVgHhB2skUCBFZdpizRil/sZ/hAwY6suKkZPdAhHaqPw6DcRIHLQOjpFy+vuRLL1Mug/lYsWWgBq6BP98W9WauoAZOKhBYI5tRdJ3hl9H8CJpMen83YHhKWy+1cpu6zFJtrzQrROL+RoMa8n6tS16fgjrCupk1Xv7UAmxi91fyDRuXziL47WuaYIZ3ygu0PP8CBDxAmP5kUft5K0Tp/K7oo/6q+DUFsLmqV1nIob4vQLsMoEtetaz4fRYl5x5lLLtEr/z/Igh3B+rKmACPvybSQdxXHxNjVi2akGrZugDueRVFnIfWe2/wbni5Ftb97rms1PW4E/6SbaGN/mCy2l083yufD76p7nnKXF4yNq7YBB+Maq+JofuaLejafx5IMN7bNyCgtw0A4jkVp7CrP5/pvKgwejolLkafhMONc8lpaWdVLjs+JHzMJJVNpx+mQ2rrIJdrsg3JrRSG1deIQoJQxjeWcdeLqQllixWbwQUxsIwLwxi3vn/mrtIOsneRTQTc5VqVGih1Ha4AOMbN4aD+Wjj1tn4Dl0C5iafYRgyistRs+S6yi1xPPMH9U4WsZ9JjdarDkv+9dSnCiw6wOwGXRrMEOMyeJJfDtf8NrVxfBa1A/FbqFNkLBA7aZUeyObVKu+tiTUrFvi+bJhjx6LMUvT+5xHtO1tf77Kt77PcmzIkKZ7zGg6EzczdkewLd74iilka8wAzc3LxXEg9SmGJvBlJiMGPoWxs /VEP9+UT p2wywC72lfz+eoTWhwNgt8OlzafNJjB0tZDjCBaWkf6blgQ0JwZ3FqYzxLazroT0A2gulB70zdc8+wGaWUcNVZsV+pErrZOtJB2ZsRpTk5XHXxWuz8g87vvdAzi2o24qMzFiWq0sky9f9GVNl29wBs+Mxx+gcULh0++0/Fu/pbSdoar5q8zMKucQYr7p0qq3BnhZNScPglCy18eLguE8Sl598oYJAt+phgYVSmOQkhPawmHtI9F86izA38Hix1VcOdpf+yIvwZG70c48= 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 'pass' file. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index 8c0acb31638b..688bd27d8602 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -355,10 +355,16 @@ 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//pass +Date: Dec 2024 +Contact: SeongJae Park +Description: Writing 'Y' or 'N' to this file sets whether to allow (pass + through the filter) or deny (be blocked by the filter) 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 Dec 26 22:14:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921485 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 72B2AE77188 for ; Thu, 26 Dec 2024 22:15:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C25116B0099; Thu, 26 Dec 2024 17:15:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BAF3F6B009A; Thu, 26 Dec 2024 17:15:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B4386B009B; Thu, 26 Dec 2024 17:15:11 -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 71E1B6B0099 for ; Thu, 26 Dec 2024 17:15:11 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2F47FB15E3 for ; Thu, 26 Dec 2024 22:15:11 +0000 (UTC) X-FDA: 82938515772.15.E77D688 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id 6A1F020005 for ; Thu, 26 Dec 2024 22:14:50 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RyBTRG7q; spf=pass (imf03.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=1735251289; 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=IPzv9GXiWf0zCJUq16MnTusT+5CPQ3yH/5vyLEA9UM8=; b=gX+nhKYFqstnSBaL9HHI3GShbeN8he6ofXsz5g63e3wOGYXB+c6apZaf1O+iP8kCOFe9Pu TfDVk1jQxvSeeD0qwMg4oaeb+BifBT3j3OlSOOyjbixWgB8QiPRi01AI0MJTH/O+oo1vJv nwViN6LPfkib4lrKKIyWNmTEGrjcRMU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735251289; a=rsa-sha256; cv=none; b=m+yaX/pJvUp02YDUjw+r8Ago6gHCK+iqDCTJTtoY1FU/YN9oQpSr4I0GnUskvnJ3yv92a7 syN4xMgYeyjGzzdPz9KYdtsiRYwaIue+akcgHRV1FabeVz12YaapF4Or0T3T50Q2x0Kfru GiqpWJsY6mtTZUE39i4HOEMZUyDRcck= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RyBTRG7q; spf=pass (imf03.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 3B60F5C61FB; Thu, 26 Dec 2024 22:14:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E298C4CEDD; Thu, 26 Dec 2024 22:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251308; bh=0f0Lpal72vM2StRK6no1fT4yLv96CM7EUNHKZOxnDlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RyBTRG7qaa8/dvTMhhcXh0+PZx946PmFR323CgbNSzEerJ1xkQT+X3v3GUZHtdewq S2AeFgRWfgiblLpevzE5ynWM+e4IY9n015Bq1o+edkeNioQ0NwUA1oH7YPV6N0KGpO KsOCJaiY7PMTkiM02GUWGCY5CZlCNq30x8d7Bn9gum2FSYqPKpKO/FKt9iHxKFeMur HvxnFxUIyLfB3XPz9cypDj1V5D6pbTTNlrTH3AH9zvCImIiWjwGuw0UPytZtQ01vQA sy8hHGrqZo0YgsxXZRxkN7GsIWIdOREQpJh+ene0uKuwewpcmmwCCm6Mcrh2PcNByG JatB1vN1zjG/A== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 09/10] Docs/admin-guide/mm/damon/usage: omit DAMOS filter details in favor of design doc Date: Thu, 26 Dec 2024 14:14:44 -0800 Message-Id: <20241226221445.78433-10-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 6A1F020005 X-Stat-Signature: ydejjkrd5k3qw4yr8e9ap8kojtf193ee X-Rspam-User: X-HE-Tag: 1735251290-18671 X-HE-Meta: U2FsdGVkX1+yyh7yXAF1M7ZS6xNIO8gNcY9d02U83lxg+cCmdMQVmXjtATCCQ7aavd3jgqjQGIYhFhE9iGI9or6cK8pE5keiIYl2cOU6OhbCAzqVxTIYiXTfEopOnO4kEszgjd9Pa0TzLlZ1kRwVNOo675BJ1jRtshLWZAY4jmFSF5XeZyT0a3dEGdoWIEyGprDMrmaU164Au600/cdNw0b6D7bb1+RBfmvOyE77wDjgcOAF6XRp2Sc5DNJb2cf7Ws8+S0aLOlsbeJcopH3FlfJiZDW7NUKqSHxD4PvSgnLCfmHiGeRs8NbKKCE91ZIVj+oULR2i6bMuAWqUHYTQP0Mw5+VDgNkBUN/uBfWpv8WDOkK3eQPj5H/1KHdjUi1q3K+tLMmtb/xxsQ+zGgn1vqVNw/sgc3z3ETOKqmndl4gf20THV6e+qDOetXYpHHUxpyS4Tu8wM8gNptSAJYUO3Ca+YUMMxZd7/22EzaPm/NF9gegx7UHrwXFFaS10o8170nsLfKMRvwXVL8ElapalLqWVWXhvtYkXMA7n2g6JEuM6HgFmzvTZJigKgm698MdNxBNs7o3atNw+R6lg44yPADpxIG6ID8oC3gubGJLECXihro1PZT3AtRCFyh0tM66gm6y2RcPSDRNz8V8BFa7+AFkoJHF+X3P0WKnAkqzF2li3OQvvc+c9+bT99R6ddRCZvlOXMThkIyCec20ocoyr63RDxrSlMOk+dIlG5YFRqQNuDWq4Bxqx3eJC5ACOY2Vtdv7Rah9dGKX5TbXK25caZ0vIesPPYAs8+uDUIDdL7D0A037PQARzESpgIBoGesS6JFtez6F4VAidCV0sxDsK3JIjlfdQAO7eYl6dxWvShIOtkMufFBuGqW2pQP9z7KIZPqv5GR1sYRjuyKjz3vM/8Zi/JdE6zJe/If90s5p/KL8eoYh7eog4r1jo9mgT0jUOgA7OkPysh26mERjbVt6 PsnN59VX X4gqzty9r4afDtdM2/1hqxSG3Eh68wdQioQjVQkknC850kc184Rx07B6QmyiQUZX+nzU4WTTSdxm9Obi3bm2yaMZuRwGtljDAf98a9VtCGdlBedzEBGR6s1eUG131Uhe1wA3cEgsTXpfGL3gfnzUZ+DKvkO0rB1CY13IP7nqd0k0EHe21K1PDykK0rgFHdJvI9GHX21jBm9z7kF7hOT7lsi2/pQBsAzObmcsgkgtRDZ/Dfg9vIWqDJvlLdWNncpJFzMDBtPf55e+WJDs= 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 a891e830c2a1..fa8a5e4199b1 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -417,13 +417,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. @@ -440,14 +444,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 Dec 26 22:14:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13921486 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 C1E22E7718F for ; Thu, 26 Dec 2024 22:15:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 93FAF6B009B; Thu, 26 Dec 2024 17:15:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C77C6B009C; Thu, 26 Dec 2024 17:15:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 71AE26B009D; Thu, 26 Dec 2024 17:15:12 -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 4CEFC6B009B for ; Thu, 26 Dec 2024 17:15:12 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0655680138 for ; Thu, 26 Dec 2024 22:15:12 +0000 (UTC) X-FDA: 82938514764.01.CB7A973 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id B11A740010 for ; Thu, 26 Dec 2024 22:14:24 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=FiFtleYH; 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=1735251261; 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=UugQhBZxG/wIEaVeQM+PeKNszL9bLzgRoesqxXjnZZM=; b=QhOEnWh62k1dY5phTGnCN8QFCPQfIWs1zhHCAqL3Z5er5xmD2aJ3QgJlXkiOwPTNDgCSq3 XDZS3tnZwHDi+KGsC+fvapnunpwsvHpDZDM1T2/+ulD0hkrQF8pcKLEe6o9TM2nhcuAE1H 2kcxJw/mWXJh60Gb+oXntYKRm1LBJu4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735251261; a=rsa-sha256; cv=none; b=4UKBwrcD3vdrBdYgkzFro70Z4jA5nchuqQKCpJQ26TI/y+TSJGWfPdfu/jlFPaJd8AC4EQ c9JmihfAQER0hnaRgPOUPDLWZOl0/o7UFtPrab/PvEwBy2P7WYKhjdKDw1wimiHQjjiyAY ukPQ3RcvKahqKU+3a4GjGDejISxHqFU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=FiFtleYH; 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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1B07C5C61EF; Thu, 26 Dec 2024 22:14:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D459C4CED7; Thu, 26 Dec 2024 22:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735251309; bh=HT0LgniPNFcsw7wjoUpvnZv1QsdPFkRx75obGWvCxP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FiFtleYHZx2N3jjzQK6mvKWSmXakMJYqF2WgASexsinNgIeXFu2I9zmBYgi+WTcXt wA2oNmJZcnpDU3HMGTFzs+uoOqb8jYVn8EhVDR6qbFrwx5fpRghRjdVB5eEgVj0I0J M5MMPngoMLlPMnqUPC7V45dAI0sILUxI494Nt3IXdoOhU/XxTCtjrAGACnscAtkao7 nc7cMXTqRdHPB+neSgZ31SVYlSeSshFPdgvtC27yKlkQxs1L5lZTodsP+kDE6sM/iU RnUXRL2D8tLLdauASaT+6FLS9RGFVj/y6cvWKx9spf8PJ7VP4rJ5tOYVVzPMFvH2Hd o4ltyfydy4XlA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 10/10] Docs/admin-guide/mm/damon/usage: document DAMOS filter 'pass' sysfs file Date: Thu, 26 Dec 2024 14:14:45 -0800 Message-Id: <20241226221445.78433-11-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241226221445.78433-1-sj@kernel.org> References: <20241226221445.78433-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: B11A740010 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: zzgtf3gqntyxxwq67xm6k3hhszgqbfuw X-HE-Tag: 1735251264-505238 X-HE-Meta: U2FsdGVkX19VBQzn4LgyLFE6EcZahf3L6AN9wX8ZtS7NnUAJrbL0Kn82lBxuMtYOsXNnI5XAFHrDopOVAgt5FTnVkYl1DF8eRGUP97rOnt1GL/q3J9GLhO2v9BVr6d1m4sOSBqv1nxkVxaH2Qq6DrJ1u/9sCjp8Va0rN7J0zH5bzz10UIPL/gEvrT/AL2J/jechCq9RBkRKsEhAh0/fI4D1n+klKJC+bqDZFGAgxbuPOQGXkPjiGWGyKTxRW+wOVtAUTkVHUJQWa8wU6TLz0+iimCOUz4QKbNMN4WC+vtIdPXT0EUsiJzXrqw8uqNdoCgm9YkYH40GMlGcBsmK0VNwtc2FnwP3Ao2eKf1J3JwfJg1bciMMEfIUAR7JCzIxYNljPi42qiiqo/ywKMuOCOdP/OrnHbi2fmwodnUBp86JxQ6JymcwcwxRM9DAOxD0oOcRYWuclzBWXdSSa0508br2WL2hSfjesogvIF3q+SUSaGSbBSHtuEkMwYt0hkzjVpb2LCAuuZxOLdinPR84py+m6uK0Iav4Y01kyORWXuPtNl8F0ZNLjdcoE4WdDNrHhzF3Mo8M95o0e196bitOib7KN3a1fsZtcYmtTZbK7+ngyO2pNEbeucWoO1Ev4MmQpa+EA2vmXdHEcdtqvegjSn/UFDuFBTf9OkZz1udce8rjxBAaQQYQa143IxxbZizCTIPe3wrgyl9+C68n29zj5FbSs78eizUtPVWcg6ESLhn4U5WtFXfU4rZUiVagF3ExLQx3IAtMnzq8Y45IjwrKbVY92uRtM2tAdeewTw9/fMixbAN0kugvPenGNxAuHqSOvrf+5k563iGoCakGll+DD9Fmbtm/BFQBgNrolDJo4EAJx7LU5kzVwkbze/22IjHxGyyO6cWl1ruuapUF6mBQk0wsrbhjT2NnsUXwG/3Y647abEZ5B6/IbW0/did7SQEYNho3diT7DVe8PKNVorP78 ISOGPfcT bWCTnW2qk1uO+HWQM7ISgffHpIzi/4h1+yZxBu0jD6rXSXWxStb91Bp1cgE6n16GDxeUEvT7Vdhn3ehPH0CUeEXldQhHVZ0HSjZgS3rOPDng68m6DG1uBaov2654Vd4vy9eDL2IcDJD9HHDxa+4kBFFG7Zqno33LrlbhX/rtupRNl+JWLizQAtjGz/hPcrGoP1LWU2egc9Ym6PgmoTQKjcTvn7VAKZLP9ykyNhFxz5a3fc1tsgv4aDBsrDcRWEctf//7l8ooJUOwQa20= 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 'pass' sysfs file for DAMOS filters. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 34 ++++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst index fa8a5e4199b1..ab343d6ac771 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -89,7 +89,7 @@ comma (","). \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd 0/target_metric,target_value,current_value \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd :ref:`watermarks `/metric,interval_us,high,mid,low \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd :ref:`filters `/nr_filters - \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd 0/type,matching,memcg_id + \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd 0/type,matching,memcg_id,pass \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd :ref:`stats `/nr_tried,sz_tried,nr_applied,sz_applied,sz_ops_filter_passed,qt_exceeds \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd :ref:`tried_regions `/total_bytes \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd 0/start,end,nr_accesses,age,sz_filter_passed @@ -412,13 +412,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``, ``matcing``, +``pass``, ``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 @@ -428,25 +429,30 @@ 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 +``pass`` file to specify should this filter let the memory that satisfies the +``type`` and ``matching`` pass though (allow) or be blocked by (reject) the +filter. Allowing means the scheme's action will be applied to the memory. 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 + # # block anonymous pages echo anon > 0/type echo Y > 0/matching + echo N > 0/pass # # 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/pass 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 ``pass`` works, when each of the filters are supported, and +differences on stats. .. _sysfs_schemes_stats: