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; }