From patchwork Tue Jan 7 20:17:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929577 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 666BDE77199 for ; Tue, 7 Jan 2025 20:18:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A3EE06B0093; Tue, 7 Jan 2025 15:18:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C8C96B0095; Tue, 7 Jan 2025 15:18:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CAF16B0096; Tue, 7 Jan 2025 15:18:12 -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 5F6D86B0093 for ; Tue, 7 Jan 2025 15:18:12 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E186480D0B for ; Tue, 7 Jan 2025 20:18:11 +0000 (UTC) X-FDA: 82981767582.24.CF0D471 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf10.hostedemail.com (Postfix) with ESMTP id 5732DC001B for ; Tue, 7 Jan 2025 20:18:10 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sjMBpWAI; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf10.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=1736281090; a=rsa-sha256; cv=none; b=oEy7EwvmE/b0Ab0JiQbf2EszfxeYy4xzvZyg1/fzOjyAkqj4xvmxysoQzafmm1RpxLwc8M VgoWck6wLaoAMdJoMkMWumi8dm64aQYC02mm9B3nrG3EuVyj9TaD+2zvn+x6Bdgkr9u0vq plf/j0RfHeJKMIk389yscL1VNP5lFx4= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sjMBpWAI; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf10.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=1736281090; 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=7MoWVonTjwjJDOaYdUpCodzVqYoCwGkAvcK9Axxt5ChkisC+St/u4qmkjmNGNLDM/x3eCq YIhY7xkU8M5/xOS60JV2p5mPIGmnDD+soXNw43ysC/ms/RGb3If0jKtjB3fVFZErOJXQpT AJ4n8/UrBAsnJQK4WYiBPsAkPYseZQg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id F3480A41CF2; Tue, 7 Jan 2025 20:16:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B874C4CEDE; Tue, 7 Jan 2025 20:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281089; bh=97I76lDfvaM6L2LOAAduyShBBxqQhcZ1zQRaRPWTvuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sjMBpWAIL0F+1FBB03PXptlqXI5T1nzKca9WFZ4dkXqiSWkqFFNLPc5FewJragYFo PHRjacKSyjgfSmKHiElJMUHk+Ispxlbfx4rXzxWPsIIP5YOGUvOQGgKU/+sUWL9eA0 a7h4Xm/ZxaZ7/whlpg0x3PXzW70D517Oozp/7iBdzkJ0qCrBa0ag+fKEQY7bpfdKqO hhBcnVqucCBCsivL3cu3sWicCS3EtgbNMEOeCvpLBPIcVR8GEymQDsMurSfo/71k+a 8mDcL1f6i5mJ8fbP/FHPEuEs/pv2tKww3/ovQRMwFUSBSDa2YJx9kVxqlASSrP63++ tedpPoOWjAODg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 01/10] mm/damon: fixup damos_filter kernel-doc Date: Tue, 7 Jan 2025 12:17:30 -0800 Message-Id: <20250107201739.79484-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5732DC001B X-Stat-Signature: 1fk1arsqzy69s7m3buw5uwygyqxumipm X-HE-Tag: 1736281090-318350 X-HE-Meta: U2FsdGVkX18I0sRNglG8nORgNnpFI+XefndcFOVjVjVgOf6d3Si7Uii/Tubww8J0s5TDlPePVAYIas4We4cDMHcEibaxdk2vFTp1ZJmFKpz0K40I26DsmeRuKv8UsufjUcARAKBzygiGl4iQKjckB6lg+MNOeJkOu9Sh/y7jAJc5pjKj+0MYXVQk+FnUrGzLuKY06DpR954lZ7EVix5bgi3z2nksU1PBYIPLPQUHVa6jBtLquBvUy8pkwGPtSoBuMMX7pBEBATnbi15aalXztekirUy61UikE6vt1jugA7XBc1fGy6v5/g6iy6I0dAlYdzdYYzR78hlvounRa+6gwlCXxfFeRnTo064QSNSn9i0vEKP4s4ClacyGNcJmYMvKaD1IEo1GcmDvVV+lbsyBnALKUEnDhyUvXuxkUkHz1g37oi4gWrb/SM4PW1iOpOn/jgcnKP8i7+0g4pZQQ6xbRBx4EYGTrYpLSA3PfFEbsG8o8AeIJ2Gkx69X5kvGAuIuQ8KESPEiTdsluN+Suexvv9ADQBMK29eT6160DYoZRCNbPUfmvw3jay+W6Qu1hslB84rYs+7ZpVedjgw/Vl1zzVvffZdqRjyEp18YnIhbVhqWniY2TY9POUuCiHGWa5mUsqi0qYks5YkVSNbf3vzzBcONEpQiF4xMc0z/5rKGYbwSTrsXS0fI2OCSzNEJRctgvAmhUFYk1ylGGat5cAV1cRgBiWIZbBpxN5/mt7r6zOspAcx9XoTUiTP7qEVtndROrJ5gMeBD3p18NK1pw6OnKNg57c+nDcOvEOL7+ifLj2N/QPYfdujmsND0teZf3+7q+A5xOMp7uwV5qR7Q/xpv/Hi7pRnWMeEFBTKpLVIQd4hjfzLfvMPcvu0eglwbejuyL39nonAh75MY23ur1BnWBoM96isEDvWmYtrv+ZZ20958wz60sDBa+p5I9KFZTmadGTutkZoB1EirumH20QL rJEVKMuW QG/ehRcldMg9gIMtZyX9z5yyS3RLrCZcuZkwn9RVU3Oy4KD/Gs5CzB01/Qeno1t7O706RSxrNyQeHtK9CjwZTBF/LNXYcST5AWIgOEVeamezuIU87ywPWuF/fc6h4o/YSbLMYXpIzot3mhgUoCeCFHMSntLEEN8rC3cgUJe5sLjw5aPD4zNUm4Pi/+uaZCoXa6wMKvMX2xHOFE0lJrnY71EplPSLscTLFTbngggu3ID9zyYFCth0TGFSeugzlmPpO2ETgMsj4+y6HDjHNC1GoEJeHgQ== 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 Tue Jan 7 20:17:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929578 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 A5831E77198 for ; Tue, 7 Jan 2025 20:18:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8913B6B0095; Tue, 7 Jan 2025 15:18:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 840186B0096; Tue, 7 Jan 2025 15:18:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72FF66B0098; Tue, 7 Jan 2025 15:18:13 -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 565366B0095 for ; Tue, 7 Jan 2025 15:18:13 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 06916C037A for ; Tue, 7 Jan 2025 20:18:13 +0000 (UTC) X-FDA: 82981767666.05.5FC357B Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf27.hostedemail.com (Postfix) with ESMTP id 744C240016 for ; Tue, 7 Jan 2025 20:18:11 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZIWbmkCF; spf=pass (imf27.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=1736281091; a=rsa-sha256; cv=none; b=yE8n3AwgaguM6cT1yQmxx65g2Itq2grsFQqSco3zqNNcrW2rKSrL1u2uruV8/eFAznvqPb PjoUqoHj3WzS1vU14J09CI74f/iGlIzoKv4Xg/wYUEzePGgJEzgLlS4eyWB+v280nkxMV9 YlS3xkZ3QHbiUWrKMnxGlNyxh02erRc= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZIWbmkCF; spf=pass (imf27.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=1736281091; 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=0WJNshEOVwaqZ5p+iPHF5LqvmaC61+2IBoC9hQ8BDIY=; b=mVU8G/HAqhRHwNOtL4ltfJ8JJfvEN+VbIQbTkqKFSlV9bpBi/HSGPE/Vqs0Rx2NeFg1Ygf 4SoNGALrlrDlxnGAGBxA+Sp37N4bnv8JCz7pwDquvYHtN8unWEQ9uXT19Jn36SXKWyZbGq Tfj02JQzdOxU42MZk+0aPCiyTJ5rxcQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1B677A41CEE; Tue, 7 Jan 2025 20:16:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 569CFC4CED6; Tue, 7 Jan 2025 20:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281090; bh=ChVZwNMuI/bsAh0W8ok2wqpnVeqESRBGmTcn2DPnef0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZIWbmkCF3+DLxU4uCCvggXf/JXln14DDVlxSUH0FgTRRshNE8iKyxdroUJnsGPmaK EB1FBF5+V+7KQW4otNae+aZTWIQ+q5ddFZLBTJx/xR5ANK6saj1wEqmVkJ9rmJ3Yec wxTW/2EarAmiOmoBxh9SMXFKVFDKNYsVKBlWgkkMk08R29R8Jcj6Q0ZVh1qlV+myfW 8Kgm96dyYY00511DZGeFqsOpU7GF7HNhqQpiGpFC5ObOVEtjZkKq0Ish0VpEXWZapZ yVcx2Ed+SNg23fVcvkBNH5lv+2nPpjQv1iaqDRGQ+1ELMDqMDxw+P3rr+caS9hlRMk NfLNkN8yEdaHA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 02/10] mm/damon/core: add damos_filter->pass field Date: Tue, 7 Jan 2025 12:17:31 -0800 Message-Id: <20250107201739.79484-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 744C240016 X-Stat-Signature: h87rtnjfaj47wjzun19x7okmthcmg67t X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1736281091-44228 X-HE-Meta: U2FsdGVkX19+5iS2U4yLXoMyQ0TISStB/OzB0hEPknYvsepdqfjAefHiUt8rgsI2mYsVt5vQ5YRQsmSv4+KzuZx09lkgPa58XHAkj6qaDkxmmzqFzT7cfe+Q2NA0qdr71Fg5xyDChMfPoJowVdfLz9k7aoOGIAjGdLnjFgDIpKKoti8vpLjjaT/4Z+uvfAIvehPnCenw64GGzRy8uc4dfYbxeLhB0Kc+vCnTUxIP/nGaPSdGaa8ZMf+FEx6OyDUksKRx9lIu+KMro1lgOO/Edvc5PaVlsoD7r7rstxbGradvltvCpQK/NFAXKioKoDXFzVFIZmtARqaTAXx9GU48mR31NLgkxInEmJ68Pd1SPOLiJNG3DgGoJ0bFZBub2yVwKp8aaZ/k0xn4SPGOCDQ6dDUH4ZCi6dGSGnFjMTyyfwlXrp1WSpWnZl38duUGKWz5j8C7xVmbak1zfOtdNdUTAH3BnknQBo1uu6QNQJ/S+GYf8wfVOY5Hvo4Nw4qt/CAhyCU8J25uIVNtWcdbn1n6uySRLOc1FM8H9iT1D49aYidEpFLU+SO4/zJMj6M6jatjst5XWgupaYhML1fSJrKd6JeYi396fLrVGhSlBCcGbS5R88i6Dign76eFetGVu7gcdtwKZ2Yjj+I0TcNuitrjwmiOvgeQOkxKs5aCEr9F23Pu3CCgTPMrV8F11KWUZqwb38j+29Wxo7Z306oo9cvjO30ebzwJU7x+WQTVjQ02U9CnLtHX3NKBlB7RcWs4LmS4MOMaNFNUXX5eyAXy4SH8Ji2aGV1aKW6BdPYJbiJyQbAjcLMGCSgmyAV2Vc5TM/eqx22fgfsPOSeGBr/ZEaWpSykd90jtjpXtSoK42Sha8nKpm7rIomLVMc6JrIRBk9fQ+6PNS6ISibGAmuUYHa0/Qk+1tQtvvB08SZt82D8+VzGa7/UQcP4akw1g2QQiRjMHsWu79jOC3YEGuQOIIAs TAFkCQDT 6Nem08acrD1dFSN5dEZsGSs+ZCJYwo0QJp8TbYMSkATomu5hZqvq7PZCYs2c3TMVJyXUd/G9ML1KdmZf7hf9kgwDgXccD62t1RnVqnV1Fz1mR9Zwqde6NtMY0XHtiszjW7/l+5TFDoHRlQIyXQMmqWUj+cjHWALtuotE6vLCnCtFVzQVaV2B9JgqQkqdXni5dbR5sPZtugmWzW9CPWSgVfXvBPogDSyRp92gXKizPpsq0U0qz7L0GaBk2sxBZsgAlPb2hvva981Pqb2bngqiCFbF8rA== 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. Add a field anmed 'pass' to damos_filter. The field will be used to indicate whether the filter should work for inclusion or not. Following two commits will make the core and operations set layer, which handles the damos_filter object, 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..baeb884ed156 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 Tue Jan 7 20:17:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929579 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 E0F5BE77197 for ; Tue, 7 Jan 2025 20:18:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C12746B0098; Tue, 7 Jan 2025 15:18:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BEA946B0099; Tue, 7 Jan 2025 15:18:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3F456B009A; Tue, 7 Jan 2025 15:18:14 -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 8558C6B0098 for ; Tue, 7 Jan 2025 15:18:14 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 46A24C07E0 for ; Tue, 7 Jan 2025 20:18:14 +0000 (UTC) X-FDA: 82981767708.11.1E32BBE Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf04.hostedemail.com (Postfix) with ESMTP id B364A4000F for ; Tue, 7 Jan 2025 20:18:12 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="CWU0WB/N"; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736281092; 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=1Fwnw79mNVeBWYG6qVyV5DZOxHBxcloq+LteWVFVpYY=; b=ayoGD6s/WTPznRBZxr108Dl7pjYiCNDLc4vqMnNUHAzp5It6rWOnmu0FErO1zFVNMrUq/r e75a2I+A4fwYz2KJM2AII7lzLvwFY5AW8faP8RM5Tn+vK+AE9HlV8WMipefRmD+Ckjbruy qjfbQOpnu3GNizRPkqypmu1uZrfPeTM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="CWU0WB/N"; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736281092; a=rsa-sha256; cv=none; b=NiyFi5i0i5qvMx4TYHcGawm4F7LgEwSvQTZBnWAqpTRrJkB3Eh6YUpsyE6hEwW01FmxA/u E9nPbJydYBHF9JEFgvKL5wGqvh4dUzE+La3OFLHMdaxjb/mr+3Hh6+BgVG0VBhKBxnpg69 /0Pz35y7xLX/17dGrFzha3ucvxnyfak= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 64D0FA41CEC; Tue, 7 Jan 2025 20:16:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6731EC4CEE4; Tue, 7 Jan 2025 20:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281091; bh=8dJ+7o3sCM8L0VHB+MIi4xnhlr9EGI5a92hneWpjd7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWU0WB/NlOmPRlgpVp5m6RizW/pJ7oVD8+xl/FMKgbU+0l849UfMQ+bx5pW52r/0c BhraHHr+hJTeDKyZWncd/S20vMMjbhTnHWP80XDrChQe5eXeoDOqFUHwSXm4oYxeW9 OIei9pW07xsVcqt8umUfH4Aq2WKPjmPC8JR3CjgGOSgM0M5+LbKE1Zvlz418cHYKy9 O+dLe6tmh+Gf+eEUjfh7ilHJL8FKyHiTpBstSaqYLvEphpK2h5W3+UCowXPsKMPrB+ IApVUYru99Kv9kHVsac+1s1qT3KXq6ayNiit4h1VoypnP+BdLicKGj95Vu012enfPx 3KtCbp1sNaPHQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 03/10] mm/damon/core: support damos_filter->pass Date: Tue, 7 Jan 2025 12:17:32 -0800 Message-Id: <20250107201739.79484-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: B364A4000F X-Stat-Signature: 7cc96bqmgbxyr45nuqkjbkb1zcgkz36e X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736281092-741961 X-HE-Meta: U2FsdGVkX18WN4tl36YTq0fdC3Ryejelqj2Ij1bBDdyvtctW5rtPu+dIS/6BdJ7+BNJBCSmi7AzOGsW5SzvdbuxmGJtMmOrER77M2UkqQK6fO1zdoebDWBtKbG+5RcJBvGaSe2cb4pJIUsS+GwW9X+XEZLy1eUWBWeK58dtk+YRtGgT3IEcKew0NCdwSAaFFHbtZH9Jh+6nAaapiTZY+yV2I5kHjnkZERYC6ZyA+ZFcXCMucoIEU0c0Ld8hukx1ltHpkY4XQRzyEyX1t0wweeJj8O/EleeFWV8NbbtJ3YD0bXGxo05Q8PsEzSg1PfS5AJ21MVlRPpoHIN8nknS1swgLrAtWJrriQ2CIdn56KwQ06K/YRGYkXZrXnKlzhVDtfKsQchLN1omN/2QLSXxVyDeas2nBQBmJ5RgbsvRYjd8PAZKQS7SCMCcXNgQQRNeNL+h2daLv+IW94Vqxz8t0mQEKRSy9GktSQMYd/p2ktrrpBZ+DBJUKdmrkGkFmLqv50Zjr1rJDKva05hjj+IF/8batiTX80czNpGIrCos78OBhIjckNHcj7NzfHKOsHtkVQP35V802PcF8An7h/8VK6WczCVgKJ0iTFAaQIeI2ijl5iOPE55TUQxkKq2puOMGHnXY8HklpcB+Kw7IJuV8nZXOwQl1YmnxJ/By54+rbiBZE9b896nvdlA61t6lltS2RDQRD4/D0gd1w9k6HCcU8uhb28uCyzDWMTYJ7pp3YgpK/DSQu3uqp7agdbel/mP0lRjRe3sIGtmCTSJz36m0JghHrv1Vl+424ygjqNMiSlbo8YKnZ30vQQIQsZtKAPcBhVSeDoOwjYwEZ5ax1ngn6SB9/dR1mIKCQVqQKMLIv3AXGDzZ5iB0TG86Kzy8q6MiCvCh/sCGYQnxN6YdX5mzDT1ffabFAEiJrM+LQU6MB4KIx5gc/7qR2MdExzXYOBjANcm6qsyNjl5OM+Kuqjq+/ n2nY3oSF 6gPmkxeOCwZStdRFDxWWgiXjb82Q+KIS3fMCovk3AlPYTYbNOhKrforpHFA6WXzJgF+50IT0XndMIOspvly51qnhbcEExb8TvMNGo0CUVDx/QOaEKCBYFVeiIMO9xYObHVCUH7ZdgFr3v7jjbjXgaTBtEBFXthKmRaOovbUy1/QqPRneJsHqfu8cEELPvaq/MIkRHnt7NG5MUVWuoCPnq1RqtFsisKPzJ2aiQX0wLZK6aHLCS2NOj8JQ0SdVoND3zgWLCuUKZHl7Gf+jV/bYs0NqpUg== 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->pass from core layer's DAMOS filed handling logic, by making the decision to pass a region in the middle of the filters evaluation depending on the damos_filter->pass field. 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 Tue Jan 7 20:17:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929580 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 813A1E77199 for ; Tue, 7 Jan 2025 20:18:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 02E7D6B0099; Tue, 7 Jan 2025 15:18:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F23126B009A; Tue, 7 Jan 2025 15:18:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD4EA6B009B; Tue, 7 Jan 2025 15:18:15 -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 AF0E96B0099 for ; Tue, 7 Jan 2025 15:18:15 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 64800160C6B for ; Tue, 7 Jan 2025 20:18:15 +0000 (UTC) X-FDA: 82981767750.27.4A8955C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id AF89AA0007 for ; Tue, 7 Jan 2025 20:18:13 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ap52vc9L; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf15.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=1736281093; a=rsa-sha256; cv=none; b=1JA0Zz187kBWKpc+7s4ogGr7nLvlv3jP3rktuotAM1mSw0MrTwHpTL8HxuNR+3tOvq40tK VtC02Kf76fRj5E72j8KXOrSSygOTioLNu84q3QaXGABaNM3mPCFrLZKD8CMcEksApyR/h0 Hf4mMuS7E0sgaRhznceUKRp4J3I6rzw= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ap52vc9L; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf15.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=1736281093; 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=l+ObGmxyfKM5RUghw/bMm3VtsO+6YPMmFjLe8kbLPNc=; b=C5JrAK1uvb7RqbvzGdq0du17XF1rdsED4m6M6fKCDoKV/WT42fk+6fZDV1uKROUPkR7/SN C65w7csqiFwx/WpS+P6kbZyno6oMluFBd3kkSI4idRSnrWJgRM04DeuhwqmJC82iDExs0J PFF11SFgBgILoTRAuA8yc/x9hiBvWvs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CDF795C5EA5; Tue, 7 Jan 2025 20:17:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7607CC4CED6; Tue, 7 Jan 2025 20:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281092; bh=tuhpVdSKJ2wYJgPTltwUOs4MNNvfzkT5HUY0DvCph2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ap52vc9LCXHiCrhKByqmNaZeFczwv/M3myDnZsagTT2jKr3KDAlahQJP9r5GqYAmv WhKuWXffp4rYtiwln3h1pBXvNPlXzU5tSlvAD+ws9ysKEeBkh3meWpdRD0at3HjVj0 B6Hq4BehmjXL9thObdsImAwxK7v2vNkDpEhocsaSygZgLDB5wF0SdLxwu4IKQqnvOc 9Z0iH54fE6QJLIO1AKsEAcxKJ7AN5BMaRMldWHKy/oMeF+1X3FzQLLP8URzqoY7/ZH lfW/eDK4hEYKmg6YfVEWrTK2waCVR/PjjspebITjSF3NVv4J8tOWw+rvDOyehpGgYf 31sLK6Tcvtk1A== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 04/10] mm/damon/paddr: support damos_filter->pass Date: Tue, 7 Jan 2025 12:17:33 -0800 Message-Id: <20250107201739.79484-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AF89AA0007 X-Stat-Signature: du9ghx5esfut3dhyoiio33jbd6jh6xp5 X-Rspam-User: X-HE-Tag: 1736281093-914056 X-HE-Meta: U2FsdGVkX18cuu58Xrlp5Xt696VDH14tXF2cqLfw5beMMW9SluF7ukwaOeQP014O7WpuAEJVW1+IEekl/eFG4RBwMR3JPjiAzowummbPRTflhokNn0mwo4wQeuTxhpjhslM1rrLEQtgIOxzOTS/Puf2uv10SdsBnKupBjMdbktZ+PILJgegkccpFfWqsDeQAGZYBo92uRY4AAWdoAjQ49GhPbFE/TUu38hJYEGuIkOvqThtBZwOIXPcwRgZVxS9Wjxg91C9cFLnz6DT2JlxsYH5f59Ynkaumbptg590XeR/YM4dGSBqCvyVnIc1qgdCGApIwDzjRfgXDGijIseK8PnSWIjYt+LH7RhpNNuThbcbnyn0GxQx4IVMy45KMvAtZ0y4X/IMl1f0Yd7p2iby2S20FjagxHqO/DAxm80sfEBjNi5hE4AmlRuStCk+iE/j83/pcFQgq6vY05xPqLV8rvZ8XV2heMK7bmPLRErFNlc5JvBb8MnnJdR76i/PAbnH5Ig/HAVj38k13qRjDeU0cKLABWA/kJn3Bz/qlr7GmEHkcfZMlMlF+P9PGvxnGIc/GlRJsPGIh/kWu9KDiUl6sj3JAJOE6138X8N8BqE5lvnrJEN4xpXD9brLTa0g6s72lk/4ldToGx9GKoycxA9XOKmmE6tauAYfIb32Cn0ja0yoepIwnqL7Ef9xrNxMcEQMqwwDyRmk6TCEbK8XaL79UNabmnIBi3xrM3+VjzNC7Sfl8hkq282MWiBAjpuXHYa2gYkfquZX7EMPQP/LvUaVmPikgCEMV7RBanRdfo2x5AknepDBAh0MpuMRWh91496GdvKw2ifYbN2N7HT4xflAuY4bxV6qAB3NlQf0HjdvlrA2nq/3dfmCxEdXwW799qdB4p1uskuT/1mZ5EgX+lKKp0r3f7YpM57BiyRhPyjqCb7s9f3Hk9jYctsTIGz9g9myox5y5S+OCSzGj5GwlcxZ pk8Dh5i7 Hh5WaiQkGUEYbsFfTC5t2hlWGrAinZ7BpyKQhm1TXGx+R/p2q9fQNXgGW4uScbuDo1re9A0PFU3lmGzcv47L+XI9Qi9mjzeGCGcECXsuihv2CCiFMcoxRiFuZDP9sjWRerWqye+wnF2qQa/FVAf5Pi20+fcgE4mLYrJPjeDEEKczvQHpl4gsxBPZqkUPYlZR8biDVgp5Cl1p1N0UCXOStmGU1mNVrNPeqaDhplF31f5MDjaOu7QF1UfUjAW+1AXTCY/epvedzhfFFpDcpMbopBOGVEQ== 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->pass 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..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 Tue Jan 7 20:17:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929581 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 53FA9E77197 for ; Tue, 7 Jan 2025 20:18:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 400876B009B; Tue, 7 Jan 2025 15:18:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AD556B009C; Tue, 7 Jan 2025 15:18:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 228236B009D; Tue, 7 Jan 2025 15:18:17 -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 E51846B009B for ; Tue, 7 Jan 2025 15:18:16 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 67FAAB0257 for ; Tue, 7 Jan 2025 20:18:16 +0000 (UTC) X-FDA: 82981767792.26.3DF0E06 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 9C73380002 for ; Tue, 7 Jan 2025 20:18:14 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OxeN3wM1; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.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=1736281094; a=rsa-sha256; cv=none; b=wJ3ukN6k3G3H3rnsfHy6zSISvCfk5nfpb4BnQZ2t5vsVVFFSRCyGOetds5VbEiNHFEC1JJ eoUV/V3yK1joHY77dWn6M+5XhaYSFCSXT8pT7gqcuOqIwfHwRYz8FGVp7gpm4USXfOyv+g M6fPUu1d9RL4P0NaW9h5R8PEPq7K4NU= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OxeN3wM1; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.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=1736281094; 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=iManCdE4JXv5RBIj7XwkgzTRGofzmdht+/ZNcrSHRI0=; b=q4700Q55Vc3ifCuvgSn2PtEc/9A7pM4kmt6RyQ016mtpAtOxiiUERMl1gB27xL8871+iWk 5Uuz0L5HGUboOaOSsiysjk4wOfi7/ZKHdCSl59e5FK2YRn1C/cxuWPY/MEadgw3wz8OgLN TfC7FTrLGhLdluNi0G/Se8WSZnZts/0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CD1655C5EAD; Tue, 7 Jan 2025 20:17:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E427C4CEDE; Tue, 7 Jan 2025 20:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281093; bh=SeGgDvPfXuXgeFvtGluC78K25dToIj5MV+FyPl+BzUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OxeN3wM1Vi1ShZ4pD2Rd4hdVw6Q7pn9tsFM/OnmFfbLKq4vdhzB8yi0XG9CUdls77 nDdeUxE1UjCDw9/z8lYYUtlYUSnh/cIhMGztGIxuZf+QPxJS9prq0NBjr+ym28T3kU gV9SOvM/KWk/rtRb0zI77NdRZJ7ldMThEWIbUhpEkMVPBtJGJ/N++5WuWzFsiR3rx+ 8/vbaa97U8+Vu9KJHF2kzFc9y/T5co7hS9ezK5u9UnTK/Wk9Kt0zr5/hByOAOb94+z GcnUN7id7QXHugoMQ+PmBGYtA/JF/vt+PzYaHwDc9qNXihcnUwjLQsj25XkllfjBGh p46hnywfBlBMw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 05/10] mm/damon: add pass argument to damos_new_filter() Date: Tue, 7 Jan 2025 12:17:34 -0800 Message-Id: <20250107201739.79484-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 9C73380002 X-Stat-Signature: ic6g5uauqk3iuw7fwegyjh3bwdh8nq5u X-HE-Tag: 1736281094-719160 X-HE-Meta: U2FsdGVkX19eSeGt3sAMhKn2v79sIjfQe2qugFl/zisgUmpAL2nbdkiI46xiwDFx3iGsd0UPdow/n5HGWQXsnHJaNneuQPDQPmaxNmclflBM/cm5OISAExRlT/MBvMzXWZ3kHp1hgUrDGhaK6rPWAOOOU28gNM1xI2lndWk5OtV7tP2TNpoGLp515RKjuqepPmeXt36cRLtpN2bhmiHqI3PdKxZg+ACIOhYOTUGWUc60sRZc0VSlNrNe/weihmTfqtJ3rdRPoBn9MsXQ2mO6mQkmrquJGAJyIgoFKWwh9xjXXSmJzTpaVzzNd1fDODC5V+4aKZbvrXjvwDtZI5vhTjnSHw/RM4KxTMxTgpJX10B8o3uTrg1Tys3WxLGest/Caz4qfan47IJ9e1PIo/OWJbNeqxMyCdy6LNLgGq92rYhK4QQXnbssr6t9edY1KR753ZLjg9BHqAj3IL2pYKEs+qmCO0ZN3ZoihCpGHY8Km8ojT8xAefb9D8NYQgMvFamyprZTk4s3Gd6zZIDDkQ5vQH8AT/p8ekqepviA/witdxLg6foAl0qDRiK24NitZpN2mM/FMAkWWGMa7gwn6UDzBxxqprhC7XkMlO2ugsMJyfqZ19RwMzECtqeOnOFebAlavpmbaGsonOx8D/XfcHMU1EyvpoxbijQRABRfe+M/pSZnRjuxBdGv/oTFmDJxm0uRmBddRWHQbZN3FvJ7hFkYFKZPpOEj+8umsiAlazDAHT9JwpE61VibOgAtyStokbpWd5fRlxSA3G07wukQL71GDvXGD6ib4NuGZ/3djqv25NSBG/FjtRQaEivmJUz2mY3nWle84YmW/6JLZZqlOqQfDNXP0Zx/Pz5cUaHZVDFTGt8BZ5eDo7uabi68zIwIjXwOnSWBbF2txojRRSpQJaXXILVYtL4jN/e4e5N1/3BEegaaGDXNhWFbCKcqIkGe4PNcbrlvganOP/U27KnkE7z fbtdeOjU 1WCNaSnroKg0hVhQIpqSzyTDrM3lnBYP41YpQGsd6dJNOFhQJ7uzWrO6fd9EohWCd3C8Uc4vDCL2dk4Uc/cS98eJ5lQCOJxTH0krfSktKlkodPgfuc05AfJYxJyj2oerPwu1uI+BhhEL0bAhyrD88TU8zLJ6LDSMw1WwW5bd4UtiKmbE3nORXFs2lIUR9l9QAIUAJ721CUjo0iPPiVFU4BmP5Mg+NifEaFqgoXQH2eRN5D2vnzopUctpvcS/vdv+KtaHYa+blndvLzU9Ns5HvVMsJRw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000052, 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->pass manually to use a DAMOS pass 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 baeb884ed156..27593dadbd76 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 Tue Jan 7 20:17:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929582 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 D6AE1E77198 for ; Tue, 7 Jan 2025 20:18:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEC156B009C; Tue, 7 Jan 2025 15:18:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B9D466B009D; Tue, 7 Jan 2025 15:18:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3BC06B009E; Tue, 7 Jan 2025 15:18:17 -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 752DB6B009C for ; Tue, 7 Jan 2025 15:18:17 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2DCA2A0CD9 for ; Tue, 7 Jan 2025 20:18:17 +0000 (UTC) X-FDA: 82981767834.02.E020BF3 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf29.hostedemail.com (Postfix) with ESMTP id 9FAE2120004 for ; Tue, 7 Jan 2025 20:18:15 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=slJilpwI; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736281095; a=rsa-sha256; cv=none; b=2QV/ppq8jBo6NJJUz2i0e9HTIhxUSEs86I9OZT3YSkegUP/l13uJumJiAEve8o7ta6PnSn vszueUBVjy65lJHXjOO4wYQkIvO/l5ujmjegxlHtYgPlDOMqwT5mvJ2DX7jmhCaOlgAbI2 XtFaPUpQmRgKfV18Zm2F6RwRyeaEKLA= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=slJilpwI; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736281095; 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=Upk9jKUU3qL8JK9t56ydCUhv2lLQWEh3nmJPJ5bv8mhRx9+blFcRqK2id3Im0VuZFCPzRU 3kif++Y5fi2NkUJdlAcC6CbD0go5X/2JlapH63iKn7OuWEFetR/qIbt69ILT4MXjkved69 LLiUhCai/2T8B7IQgRVrUC+AN2WDYoo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 4DE03A41D08; Tue, 7 Jan 2025 20:16:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE4C5C4CED6; Tue, 7 Jan 2025 20:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281094; bh=ZERQXRIpbhEDVEpD6J6LgTdFsTQpbeeZuCqI48fC6sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=slJilpwIOoWc2ruriXmweZYgn+/8so1cWoZ3VtcHYglEtfsQV3O5P/QcknYVWIl/6 Uj0dxHDQ4mFZQtIY755fd7pfC0oFdHjkFMyPMYtjAbmXbFcUggxCRpTakGpP852ZIB 7AgH7fKhj9cBedscF09kRtT7rEtw32LCiK+0HpAhqMMZ1JiQgmQivgjQMx/tI5jI3A Y+psKcsEi6caa/3wxr3kuMlvxtQf7UOsp50JIS4qNs8zIqExutcm3WC5DPjUbSxBgC 6PaUBjyu6mJA6AOD3Cr8srUrjYMY890PaT0zEfQlMEtz77lbUXwCgu7u6xQOFnC1/O JQnwkn3DV+TLA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 06/10] mm/damon/sysfs-schemes: add a file for setting damos_filter->pass Date: Tue, 7 Jan 2025 12:17:35 -0800 Message-Id: <20250107201739.79484-7-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: smjxajhdzw5idr7knqe74mfrrwudp5tx X-Rspam-User: X-Rspamd-Queue-Id: 9FAE2120004 X-Rspamd-Server: rspam08 X-HE-Tag: 1736281095-861601 X-HE-Meta: U2FsdGVkX1/baBww5nPm4syQOC15BFJugKArZAAmmT4ZEZ2qHd2RjuRc7xm9rypsa4aKszGncIeIOLo6rYhj4uvAujtc24m+4j/pTuhynxLv4+zfJBtyIHEtWywQd+oRqC1yql+rgk7QkROH+pf1oZ2Q1El657RIzQrfIF2CUxHigVaPrSc3p0RRCstrtjc3mpOFEXCsdZxY1lzydohkIXsfm1ID4UfX7pcwtpuxCWs22HDMEj/Q7WlJXzqql3p2D6E4+rtVs+B5YaLDpGB4ifburCbMAHJZ9t4yIHOqAVHVENIdAFgnn4YNe9575LmAj/xpcPdTS9P7+85McIlKT0fxCobdWaY6mAeznEZsIkreSAO//eTOij2sLHPWmzpaOlUOKiMgeDWyzccFEJNpqssfBQ+0N52jJhXZgmrN6yAuGRlwm/rpT4PAKx5AXEgJHZ1ZYzR9aCebN4AH+40ho314T3ylgpDfAv2LTDwPWf9B53PcVbDORsTv6Sr8CGQO/Zi1o1HsTSaBaf6blQv5Bd6n+IQl2df7trly8U9AD6qFrOqsuw11Pyy2blLkLiI2gnLHHcH/Q2XKw917IgGGGomhGuzzxgD7CqjymOmISM+PqqSm2k/Z7XSwJPthU0b279+8Jno50SMxrZVqNt3TyUW9RkY0YAJZRq2en6DBaJPYd9pnEdskdqwlU4lxWbD3mjrZmLUBBoNByhHUKQWuYWEH+qr3/9rAEDQTN9EjxYFxOYGYhVBGN8yFI+9vLEPR2ePJ7f4lBHcJB+Ir1S+usmDZ6v0bBHph6FrvEwnshPF1dcezCddjwXWLj2uEV8/8R6c1hOY3fWGsaxGdRIf8VbUlBWEVpUuXjMBZBxuzCTzALCfvs2nBjghYFGXrjM2nw5K33chj9SGzKVdDDeSHZU+Za7voECUvA/JkstjM5FAxq16rKqqFY7JSRpGIQ/wqHUAloMWYASi6Qk7UwrD 17nw74+k eATu9cQnmUxiw+7Ocn598DkfUi+wqqgMaXRRiAbxxzp6scum61DkGHMXAiIx+qgDCFkiiAvXyU74aWfC2ZZG1lRmnnwoY7Iw3wUnO1AHkbWCZTxyHXgLZxqZP6IwuPDyDUsBef9k5f8O5lZQFriU3jMV9UvPtO8apKgqacUQQr6iGf+7MO6eH6QVXbzsyW/fDkzKGgynAIzLpVvHU2GKOvE34pL9sQDPSetG7Sc8JDu97GhoyWQ59Nag/AGPu9OMuP5jvZL1jtb9WGZrIAeyRpzk1vw== 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 Tue Jan 7 20:17:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929583 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 5280BE77199 for ; Tue, 7 Jan 2025 20:18:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AF5A6B009E; Tue, 7 Jan 2025 15:18:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 35ECA6B00A0; Tue, 7 Jan 2025 15:18:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DC1C6B00A1; Tue, 7 Jan 2025 15:18:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F26D26B009E for ; Tue, 7 Jan 2025 15:18:18 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AEC70140C3F for ; Tue, 7 Jan 2025 20:18:18 +0000 (UTC) X-FDA: 82981767876.28.4966307 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf06.hostedemail.com (Postfix) with ESMTP id 2007118000C for ; Tue, 7 Jan 2025 20:18:16 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AkcueAy9; spf=pass (imf06.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=1736281097; 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=Cp6u5mTnPRFU4Vdxe3I7RGWgBiCRKei4/NOOyFt13q8=; b=q4xrDAc+LzgHnQEuy9lOmbWG/cuXuFkElPgok8GsQRXOHb6YKwB9TCNov2Z4vlQ6Lgq2kp tqthZZKXCu61tz9MRzk5lFg/dfz6ujLNsjGH6hjzQLxdfYv/FnSJyi3vTdSQwptyPbOfKX l6VJ/AaoZsp2wz6Mm8hW/OfuTtgZZzU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736281097; a=rsa-sha256; cv=none; b=L1UChZE8FH0de7OWZ48MDUgjAo7iwWWpb/zurU0hFsC3Zo/AimM5rdnEDNWkaBCecbBT+T kPEv1fqu+SLGNs2LZTOMddF4efsw/MDY3tjQHP/cfOLVN5FqJL2Jy4nA3wwQABKjDAhIXL bIfB9v5AbYwz/0kcfFQWca1ZJxZjdUk= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AkcueAy9; spf=pass (imf06.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 B9890A41D16; Tue, 7 Jan 2025 20:16:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF4E6C4AF0C; Tue, 7 Jan 2025 20:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281096; bh=HXA5UPYM/GgxhLgL56pBJuUIhF/kTZ/VCy8SKfZbnOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AkcueAy99tJZzibzNuROIjVEKSp3HVa0hplQr2dlkw1Gb4ZhWDBNd/cLD/u/ExntH 1S/U5SbspW4U4kLrmfEBFI6cn8HblH6UfAiESFY4H8iIbszBodE56UyX7SMBYU6WXz HVYY7E7ePgU6U6V+HYBMV5VdL1FLM/XgidFBv/I6K+8a6YcRCd/pjavVsIt5/57KGX MwyETpH0e2xqRJOjCZIdiskc7WpdNznQpjK9OKaF+Mhw9Uqry1eCro0XRRfVCB4ozr KIz6kJd4eaY1KZj4C97MNDy1IZwc1WP6gJErNxNCPX6D5NYyYCj7liTu3SrtGNfBKi z0G4cHcLCp99g== 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 07/10] Docs/mm/damon/design: document pass/block filters behaviors Date: Tue, 7 Jan 2025 12:17:36 -0800 Message-Id: <20250107201739.79484-8-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2007118000C X-Stat-Signature: worie4pq9dadt3irie5ih689wmf1dok7 X-Rspam-User: X-HE-Tag: 1736281096-662532 X-HE-Meta: U2FsdGVkX19QdCdhCe8K6N9DtqZf3S6guEd9XrQE/44JXTzs+KEF9zyGCu1vTpt73QmIi4mxEFqEmmSTDNgzutxDl1GdS0OzvXpBxnwKIRVspUdHTB50yWA1FXKCOt5Ne1ZWNHvUt1+t8zdmzfwRhdo0yAug4UyKJDSEBppD4oSbmeOE8upraxGEOwpstWbezp7gguG1Y939C9oyyxzmGhnDQ+YOuOzoSyasbCMa9piEj7obaMe/EslzoAjMCt94EjLNAMz0agoRRN6FglvuIW4OXr8RAA/O1MDcKfU0W258liqBJJ48dsWwyktDAAWgF0Kq+a5YcmYXj1B68VhuIH7dZVHiJPZwCpmjVR5swuk+T40c5Q5ztgAfTLJwAjahR8pemEbt8vTHFBW0gak7PhlGFVr2WhBrYTn8ZeAIsV5PjmHfS/+dWM6f5yHfXNSDIm6mMODMYJMNDbR4Urfza0Szan7omzNYWyPoVqMgyhTFAUUMGk8ziucLWcEEPx070Xdi7Fel3YyRs412OFwgpUFKqpmwfJSM9FOD2B6kjkw66Xk0CBG3BhDH6O9/j6H477QHQiFTGhSbW4JSYN/3llCGnWFV1Q5Hl8rkU2/aPH+a4GnU60arvQVOw6XO5NNZFkOuBjrLZb9f8Bo7p2abXKmpAORc9L5ACNp0WSOehX6N5s34bXEvjGp7r41oP6VFyji7zukFizzheo1CzteroLXHffFssZP0sEe+sev4VZFSIBYBgiE1AhQ9IzUNsLokEozzslOFJarDHR4pavhInVd593ngfUlPIPvdN8PoYU8dIN1Vi4xQh3Gqet62a4JaIo1UgIfHMezAGUUvSTZ8zu6YKahJEzUSIz5G/0qqGHnZwl10Qb+dAT01g9BMUiZ4h69gB3EXlfQIGY1XGKJaiQUXhZERCvvRuzDwuX1hUbNw4uS6Z32yp+RyHeccIvFGNEMli5hQSWkj/rxh84M 5zFYW4cp HPnb7LWfOq3mbbe5eJaH4zIyddq1Az/7QAUt6YO81sFRT1TNc1ioil7fQGmVhseDIbl4yv9JcAXjbiUstq15ll49cXK13lOONS+fi73YSyHKWHbb9JF+XTFfg4q4ItfA3vracMzTFfCW7paQF78iBMFhJwx2/EB2LoGKfCqe4p0xLG4ZZZf1+H1hiaLb5P4Hj1vNy2LlPn9/vATLcE3KofJdCVjX4WE2GkrD0lPTFfIGfBcE= 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 | 34 +++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 449eb33688c2..3682e719b8a6 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -504,9 +504,35 @@ 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 evaluated in the installed +order. If a part of memory is matched to one of the filter, next filters are +ignored. If a part of memory is not matched to any of the filters, the default +behavior is applied. That is, as long as it fulfills other conditions of the +scheme including the access pattern and quotas, the action will be applied to +the part of the memory. + +For example, let's assume 1) a filter for passing anonymous pages and 2) +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 or not, since it matches with the first filter. If the page is not +anonymous but young, the scheme's action will not be applied, since the second +filter blocks it. If the page is neither anonymous nor young, no filter is +involved, so the action will be applied to the page. + +The fact that the action can be applied to any memory as long as no block +filter explicitly excluded it means that installing pass filters without any +block filter after those is same to not installing the pass filters, in terms +of the ``action`` applying. Statistics for DAMOS filters will still be +accounted, though. It is therefore still useful for monitoring purpose. 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 +542,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 Tue Jan 7 20:17:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929584 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 C24F9E77198 for ; Tue, 7 Jan 2025 20:18:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5AEC06B00A0; Tue, 7 Jan 2025 15:18:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 55BC16B00A1; Tue, 7 Jan 2025 15:18:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D6246B00A2; Tue, 7 Jan 2025 15:18:20 -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 13BA56B00A0 for ; Tue, 7 Jan 2025 15:18:20 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C3F40C0354 for ; Tue, 7 Jan 2025 20:18:19 +0000 (UTC) X-FDA: 82981767918.05.3F36F75 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf04.hostedemail.com (Postfix) with ESMTP id 2C23240008 for ; Tue, 7 Jan 2025 20:18:18 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VbdBW1E9; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf04.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=1736281098; 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=JKBOiaIxGcslLpNN4DwthulHqK+67MbQ3oaM2nTSgWjspMShyL+ENvrxq4sYbWRXemdCMx iXkRl50LyBuniIBfj1EIY2SYgFjwVueWIzOhhcwpWRwj8g2Rni+TPLlxPMJd/KkULHz2RE Qs4L30AruaL5qbXY2sSmrVxJ4ndhXFc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736281098; a=rsa-sha256; cv=none; b=51H6ZRIqB15GitFVEDUE0P2v2/l2Nt27e4mz0csUGigtZKczUaYaY+oygLI/fcYlnJhhZd X6FAsK6bEJObOiVZQLnJqhndjti5tclQxq2s2qdNyjBJjwP5Asb2kwl59XXEPDDqjXqM6N SadIEs9sLze40stpuWCGBO3BlyqKfws= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VbdBW1E9; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf04.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 3ED365C5EA5; Tue, 7 Jan 2025 20:17:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F20F9C4AF09; Tue, 7 Jan 2025 20:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281097; bh=juadYvUhIrNs11RvqR4w499ufNXf6y5+YZmNZP0gQvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VbdBW1E9YONp1KjOtXnLbXq53XWAzctVY97ritUODquibRxUPZZWiU5WkzWFXjWRY kU2UIFngMpXjNhx655Rrt+wkjr2ZCe5TRPd/ek/hZ6zWiYaNUm5vrpDbW6/Zh4BEHj D8iSZ005boFIlqHbL5Ml5NfI1Pv7D9s946fqPhleNWK8z0DW61x0o/Bnth/rP/bSJ4 SR9DGqZJ/0fJ0mIw7A4zcp2NXX2edgROmOyrZ+PpvFj3fObM3QtELW2Knf5e/F2I2I shbTXX1RbNLRguI7G75mWmQA3Y2IKE9EyRCd8uwvOI3o8DlKWYjXlJmhESDXDyskhz z1pmCBCFhzegA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 08/10] Docs/ABI/damon: document DAMOS filter pass sysfs file Date: Tue, 7 Jan 2025 12:17:37 -0800 Message-Id: <20250107201739.79484-9-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: fo9ksomcpfrex7rbu5jpxrd3ad8f6t6x X-Rspamd-Queue-Id: 2C23240008 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736281098-503189 X-HE-Meta: U2FsdGVkX188XQO8DWiQub48SKJmlE6zXH82WU9HYZNKmDXKzo3cwi/26x0DzLS/GFt9cu2p/+u/Z64BrdtinB5RpD7J99g0Wp+Ds3apLPUNspGPjy3UNbf3JuvM2/OTE58F96bsuTO65K15Ni5PW+aZWfrqfu3HCTaM5MwYTOxH6DwNxSaQ9PojrY8IRhqQzlUlNf+DxbZ+rWZqOjDFaCIpEigReH8UQd0wR7cERY/CRa82eFuaVzl/BwcmU4N83EwNP2h5cuHVInhYkGWaBKp/xtYfJWvsPZG3jTv6trnOnN0X8JzTtNl0lLmKY3Lw7je3PSUEULcHWKE4G7Ea8vM/7r6tkEGztL0xVORKThuhjiBrq/BYVlDmT1ncrPMBVKtf20pke2+4/XNy2manmZDcQeVcoLj0mxNJDlH8bKugtrl5SmdFOKF2LFdD2P1AHkgQ5+bS7Cc3EUDLMOqD11MrBG/T+KBW3TT9FdmlTl7JqJsapHizAGQUUyyJ1oAX/x6F1kipzQDd8GJTv7GCEXMMOE1t1Hap2BmlV/pPMhyouxPd8vB1DSGN/nhBWQwST3udnxSlooUkuTjuT0FwnAprcr0T9oz5bJXgez5bJGpImcnE0N4ZyqjFT21EUZxe/CxSliXZjt6AreGgvuD9r0iIjA/cS4v7efCSJInx4LzcnvZdopeV+n+/5aRQdXgcVhqZNBE8srJ2Nf1ni568okrFHQr+wzzmmyB7rBh3H/hndGR9YiuOqbKgZ3OCtAPwx1VLSVBJfYODn+cdJOMM/p95czJkFylOGHx4e8UZ4pSNMHrIGkgYPER5JCZog3QdV0apFQwsVAheDy3r3wxYHWEVSL3BdpVhXfOLasM9qW65XkHsFfpCKd/wecMYoOlFOXbe0qKjmDDOMmaKWJHc0oxgjKbL9ly87uxw29xt68o/WxI9pGz+V2xS3gPnn0ZIxrj1H/oV5fO+M06V2TD aArWJ70b xucdms/1gwqReGspOW5ruJA/aC3GBPzH9dIZ+ZCvAAQq2A/nVaIFsIdPuWbisoXY14I1SuPEwiFoAjPhCIwFLrDOovy/YkHYC/3zBDYpVYLoq8FqcxC+V5TESAoLHGt65e50KNAVO+YGOgZjLzvBNSo6hZ4+ga7isQSytxW084IJ5ZcC83gvdlUq/Aaz0bqGe6X6szFQpDkMIl9t9dB8VmGoEYLdO1V4aTQh9ArzUBPrkn3+GRHRcNgBVNwNKRPU/VcEQEr6vq+T0QSo= 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 Tue Jan 7 20:17:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929585 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 44D06E77198 for ; Tue, 7 Jan 2025 20:18:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81D776B00A1; Tue, 7 Jan 2025 15:18:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CD8E6B00A2; Tue, 7 Jan 2025 15:18:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 66D786B00A4; Tue, 7 Jan 2025 15:18:21 -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 405976B00A1 for ; Tue, 7 Jan 2025 15:18:21 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EE431B02EC for ; Tue, 7 Jan 2025 20:18:20 +0000 (UTC) X-FDA: 82981767960.29.E36F634 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 5B8CA40006 for ; Tue, 7 Jan 2025 20:18:19 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rRBPMc02; 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=1736281099; 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=oY0m8JawojYg++QMsbCCkfStkSt3afELZ+FtvFmq/lLgYqdrKa7et9GGVmVWv4S+bJ8Jg1 4oO9RF261K17DpPdoKcQDBdv2TbL/tmv2zfw4QKgaDnYaT9+NT5lP5QD6X8VDsNpdoKVNF EtrggZPTtyyoe+Gkm4k8oBp4GJhAcpk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rRBPMc02; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736281099; a=rsa-sha256; cv=none; b=6USB/Yb+r43YiXV6Ot9mUm+T7rfPpNp7oiv9CjqEH2F/+n/Hx7vEgjFwFpIYBFW60oWswu z01CEj4pxDjfPoZ74Of0VYhA70VTotWjck1XKBy+VpC92s39y45fS0S5yqYIt2XqmgYLHs QBx6omiyffR1uSNwXflUqHew3Si9rQA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8018C5C5E3C; Tue, 7 Jan 2025 20:17:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FD29C4CEDD; Tue, 7 Jan 2025 20:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281098; bh=jufb0sHL1L5krYu5xZ9uPN7YQ+OC0Evk60XYWVCJy7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRBPMc02CwogiTNi5E146sB1ifHgBJA2nZgVoBsESH66eEv+lycI38Q0SlqUy/xOb NMjHjZ2SEar/bVvmTWvwe3wt+Ux5Q844tzODLcdHJIrM4z5n4hz46NI0Io8laCjXPv ihZwM/eHP4dY8rtp+QXrFDijR6eGOxOw/OfKBab9RajpdYr5N+dkpD1hdDn9DeY1BM 7sw5pC7TaW6wJY0E2yUVytvSrPLTWV0C3GQTVMQh54VcSxYJq/qQ/wgbqx81AtrBiW jCYlXyACtoCqGDvcV2hLKxjDlfpI/SDXQ2UJ/ad0hTi6/yF0bHa6KpNFi83UWmk1wv af20A1eVXJHSg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 09/10] Docs/admin-guide/mm/damon/usage: omit DAMOS filter details in favor of design doc Date: Tue, 7 Jan 2025 12:17:38 -0800 Message-Id: <20250107201739.79484-10-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5B8CA40006 X-Stat-Signature: 7gge34j86zuftykqus33585wjqbhzsg1 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736281099-498285 X-HE-Meta: U2FsdGVkX19ZhqK9pgpGVNFrzBqJZvWt/IR0kzM49ZcaiEZWkVjiaLLgPS/D+Og/+85EjKBUZ1RGn5/DsUpPJh4KgJ3eBiW0mTH4l7+BIAt8iZbQ7YwHEAWPn/cKVAdmgt9ywLyHvDvze/pVH+UfA9QpSm43DLZqLkiEG2dUY85doBA3AEuOW23LCaiFCsWiWrgG/TA9QTZolDV/piCZLAZnlQcqI1h3Xu4LHduZVt4egx2Djgxh2hY780r+MbZY3po6a2dxVu1irujzfW4hC4zJXqGEdLrnlLpwiL3uiVGzHMeSR7TfLT3RgMFNIWxUlWPSha2jNfM6oGcEybrNw2d+HCrOGDcUWdOL8RejEQdKJcqYEBUFkOijlF4ZJKDBFUDjDhWa7ViZa3twlXUq7u0Te49Zg+CgeWkworbGi3gaGpQZ3Y4YX6hvZKo9mKajdwMy1UYz0UUdXO9eWikBmQdB59zZsQPmWr0r9ta3kt/KcCZD9BohzDXX3Nhj9TErj+SvxMSdY2kChYexZYxmD+eoW+4gdMpc111hZy99PAmUQ6q+chhbiP8Z5DhHcDLQJunYSaux1hd83QIM+5UIdB5X2FM4uCn+U54l7ChebyWA1GxJy/yWh9OtbvVXVQA3EzlTr7mLLwqIH0ctnb1WGpST6tplBXhcpa4OLqSFDQk8Tdrp2CyPbhCgYXXMd7mHCGFbkmWVRZFNygEMHWeRNwrq2FjWPnm+35ONsXGaZdaq3ZrjpMDcYvWC/BR8fOEkfJYwK3zicx7QV/0n5eZO768I5P0OlfG12DCgp4ytLlczhDLLRdR5cO3G6TS4I+CoDyrahdH2ad3CKmYglUK4W4o4GOn63U6EsfSqP28UsasW+WttGfX1R21QvnDdOArOZO+3sy8opzB/MlaM4Ox8syvyd6iVek4cJ/t17e1P7pmK8r5n/mQmcTJrILYgSWIg6Y7KslePl5ArfMsi5VE /YSDOKj8 bQ5ycP4s8rnT9P10hOWULEH0ZUDIX/dzJ+R12HW9xK9mEwdKsMJtcSJp1VJuShi8e5qLH605QlIbW7PbQ/8pHS3HZEidxkZhVuYrBBxaqSm1BNrSWYcrke8NyMIh47wyVwUqbaDVwsvU9EAkwtwIJEIyr/29fmmXahihP8uNzMcqyXfPeBfoZTpq08tWvQvRIc+RSnT3QZ1LVD6g6GlL2+BbNvskzcxly4iibg6MJu2CsjlszhBldwcqjfHKKe4uNSbZKKj3NaqfB8ss= 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 Tue Jan 7 20:17:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13929586 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 BE248E77197 for ; Tue, 7 Jan 2025 20:18:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9AA76B00A2; Tue, 7 Jan 2025 15:18:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D22CA6B00A4; Tue, 7 Jan 2025 15:18:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4ED66B00A5; Tue, 7 Jan 2025 15:18:22 -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 928FF6B00A2 for ; Tue, 7 Jan 2025 15:18:22 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2A25C120D0B for ; Tue, 7 Jan 2025 20:18:22 +0000 (UTC) X-FDA: 82981768044.17.4645C28 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf13.hostedemail.com (Postfix) with ESMTP id 8A74C2000B for ; Tue, 7 Jan 2025 20:18:20 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ell3Q7Yy; spf=pass (imf13.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=1736281100; 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=L+809XkuIWNslWGRy2McSJ5Pstgzf7buS/wLZUGypys=; b=h0+uP9KbjwzAS4YmdThvb7a+BgEYYgD68OAw4bzp/xlufnvhOaYQkAIEggGTVBcBVDPfQL oQhIIMB8BSbrGWRM9ILmfZV4npJEvZd3j38zEpEt3Pv7V13YMxdqth77PA/ex4nVczwwtg o6q+02OuuiSCzS69hvIKzBdvmlanUcc= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ell3Q7Yy; spf=pass (imf13.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=1736281100; a=rsa-sha256; cv=none; b=afsWKg6t8VPGrr4P9MEqwIVkTuofLC4KlVpJWITucPp9uQYdwR60xfS1ypTKCRQYVL5XWZ zRCLegAswzpOsMXF0CWK0emb9qXz2p3JRMltv9YXUziKqkdrj25RLJolYY3kJdx8bVe3UK AMiXoEeXrEUSg4NMaO1uA25xOfTZwzA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 2C9C0A41CE7; Tue, 7 Jan 2025 20:16:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 653BCC4CEE0; Tue, 7 Jan 2025 20:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736281099; bh=jFfn5t+dponFAGP3JrCrxaFExzSUl0AtcYmSwZg8NL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ell3Q7YyhnMjQuSHIgsYWdtxHKNCvQFvRlshmwRsgkIDZEu8EuiOyfjNdUmTLSTCn IBqPoOoSLWO0vZZUfc0dj7R8xfulqbLkAam9UNg1AC/MWNZdeXPvUv6BWO0VQFCsX9 ZmjgVBfqS5AUEo3zaH43JvbCq2sVU0RndAmQykdMOFZZNuvTSyMHdLXxhCEov9t9pl Yv247oIGa4qDtKX1II71Bj83kdG9XBcw8w6MVxruhWxF7FvYCBqP5BPuIf0yab2aYV Tk1UOyrtxbtg1LghJlv5zea4jl51FbkyGnIMnKRTMlTRB8KSDG+5PGBlyiRcg0nswr e7qUcvirZ6mSw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 10/10] Docs/admin-guide/mm/damon/usage: document DAMOS filter 'pass' sysfs file Date: Tue, 7 Jan 2025 12:17:39 -0800 Message-Id: <20250107201739.79484-11-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107201739.79484-1-sj@kernel.org> References: <20250107201739.79484-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 8A74C2000B X-Rspamd-Server: rspam12 X-Stat-Signature: um4trhux87dj7eif9z7i5cwdbe1jcpxi X-Rspam-User: X-HE-Tag: 1736281100-334146 X-HE-Meta: U2FsdGVkX19Yu/UfBbenHLzkn8QJ56Da7YERTMPPPp8f31LWUBVGOu1Y71oHd4WkJJX61D94BNhL/u4M889Vjt9OISyGq/mUGa6rbWZS8ZNa9e926m07LrSEcy6kbiXnuWZ9kEbaCDDRZdwshnYd7H5GmCqE44uq8y8vL4z0QCASnHguY2Zw4Z/or2rWC1Vhx8/oZCh4+PSrzTCF8+XaUOumpaSEMObAtoNyux5+Y8E5BQItQT8Yq9YYlUQLldVTylfQ9dWO/BqOW4Y89cSC5QO6oeWLDdO2yaSqsluLVNRPPVy9XnjLBs6EuWqr/DN2ilwMlUZ9m172onLDMTFXbxb1USFg4QPrTcmT3zmau/dd8s1RNRKkEPZZWLNLk89am8OgssyR3E5lDS46VRZY4bVu7hXm33pVbvg6ieYiCOYe4C4f1GjZ4DcZOQ6+fo0SDMQQALrD/kVQq4yc4330FJzriBfqJxQ1CPboDj/hZEefMnUYtrND2EJPF0vLhTyR2yMzG+A4dIuGAgMHKnP5UJOqdmjy8rb/ZRlca4bt04P/yMqElkg2o52MPtvLAkEX2NlVklTzHzeDH1/itpbJXf8VomX8VmYIGuoyYEeBA+fBibGJKT1uLS35PoydBllP4La17Ekec04VXoyofGPhlkM1VWBPTxvDjy0WljRHI8TzlSBeFXwNlfLiQ4bf/RBtJBsp67lGTmKjcvTcuhbv/PzP4ys+57/80mbUeomb3xYvPJIz9IHrxZLLQPAID0I6CBcfYi98NBBVro5Qz7eotVHF9DgfkbSkMLlrsVMhYce38boBunhn++Exx9M3y3A6mnH83J1xgx5Ah4+rIoWVuyRop6Yodb1fR7XseEj17XAfMXipJvgKpoVFNjmV6f53gGPsjX9ZF4X/7LxXkCWH/hC4BONGoGAUafIy+xU9MNK9Bs/EWiHEvy7EVf/r3nF8CD9X4rBr1kuzTKc4eIO Iq8a+Hlf NIikE+0WnQRQj8JbNEFjcoCGPUvRE5T1FaurL4JqiKI2EqXk1vJwE4R0Qe+tZfoCV3UC4W3YRHqWvBzqZOdcMqmq4KyWC5jqOxu57kjnvYhcXuEAWvEh2+8e1fj2bHSASFv4BbMyLzpynb6KgvU80kQ613SYLsbQPhNlGwYECROhzPgfkng8YBkjPjdM77BaGs95ibSiOnjmqzjsKFX5uqkskAHxNuaMRZqR4gdFoRb9yNdN5aTWYb9KqIGun85yNNNOzquGT3aa60jaH/TGxLci/QoTxH+MRAPfUw4PrMNTMPwM= 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 8df3357dcfa3..77064c704bf2 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,pass │ │ │ │ │ │ │ :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``, ``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 @@ -422,25 +423,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: