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