From nobody Tue Dec 16 23:25:35 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93CF7137750; Thu, 27 Feb 2025 01:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621482; cv=none; b=GN6k9zT99EwBe1Ke6SFK5dI2KnIgEprKW1pqruZzNRVv1ZkcSJmWkSld4tty0OMpiiQUnZCYmHL1Kg5wtEwT4rdqqEYDkfCzxAzv+OJ7TouX8ebQlNkSQtq+cqSEqFNiTSfRgXiR4VX+hbuOF8EJyw5Djklxv89p/62a/cda8+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621482; c=relaxed/simple; bh=rhFsNhRUaSQHgawNxfN1Ke4vP/OFw5KgXJOej1ppOTE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fx2WY0qQ5EY8GNgr5qcjM2nRz2hQk7Auh+E9TpBYA01mHH7cF7Azk5lt7OUiVvaH8ENBclm0jNnitisGyUxG4HE2dNyB6lp1I/35QhHTQIVCg6KGD0sEcS4pczknTpmgB1SZEop4Q7ka6JYf7eMgRBxZbzShqkEWV/93jt2Q3h8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=js2t26O2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="js2t26O2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6F20C4CED6; Thu, 27 Feb 2025 01:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621482; bh=rhFsNhRUaSQHgawNxfN1Ke4vP/OFw5KgXJOej1ppOTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=js2t26O2XKtZGE3Dz4T21JiIIrbyHgstsd9l+raa3zsams1DBAgkQLkYwPi0NyhRI q4ldhoGPKcn51cyoqXBfa241uVi4FuI0GkLDtQTqv6fOeOKZ9we1erdUXNZQDoJTgS dxsQ8tRhCKepDOSGM+pbDpHllMX4mXc4BllITmwitSgviys/u6csxyHxEdALwpIpZR i4X82CfixbZv4fpJALo0oUbF0LwikzrkVKhQIwo2KodrClxrSO/lyZ8IbGDHnBmFGk GjrHenlFCJrjUDy9GHEPykIBZ/GF/NuiVphMdYE1Eth3aYmkkPr/6LzCVfYcjfpOFo AJ+zQgiMnBp9g== 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 v2 1/9] mm/damon/core: introduce damos->ops_filters Date: Wed, 26 Feb 2025 17:57:46 -0800 Message-Id: <20250227015754.38789-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250227015754.38789-1-sj@kernel.org> References: <20250227015754.38789-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" DAMOS filters can be categorized into two groups depending on which layer they are handled, namely core layer and ops layer. The groups are important because the evaluation sequence of filters decides the overall behavior, and core layer-handled filters are evaluated before operations layer-handled ones. Currently, all filters are maintained in a single list (damos->filters) in mix. Filters evaluation logics in core layer and operations layer iterates all the filters on the list, while skipping filters that should be not handled by the layer of the logic. It is inefficient. Making future extensions having differentiations for filters of different handling layers will also be complicated. Add a new list that will be used for having all operations layer-handled DAMOS filters to DAMOS scheme data structure, with support of its initialization and basic traversals. Signed-off-by: SeongJae Park --- include/linux/damon.h | 8 ++++++++ mm/damon/core.c | 1 + 2 files changed, 9 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index 795ca09b1107..add82fdc1117 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -448,6 +448,7 @@ struct damos_access_pattern { * @wmarks: Watermarks for automated (in)activation of this scheme. * @target_nid: Destination node if @action is "migrate_{hot,cold}". * @filters: Additional set of &struct damos_filter for &action. + * @ops_filters: ops layer handling &struct damos_filter objects list. * @last_applied: Last @action applied ops-managing entity. * @stat: Statistics of this scheme. * @list: List head for siblings. @@ -503,6 +504,7 @@ struct damos { int target_nid; }; struct list_head filters; + struct list_head ops_filters; void *last_applied; struct damos_stat stat; struct list_head list; @@ -810,6 +812,12 @@ static inline unsigned long damon_sz_region(struct dam= on_region *r) #define damos_for_each_filter_safe(f, next, scheme) \ list_for_each_entry_safe(f, next, &(scheme)->filters, list) =20 +#define damos_for_each_ops_filter(f, scheme) \ + list_for_each_entry(f, &(scheme)->ops_filters, list) + +#define damos_for_each_ops_filter_safe(f, next, scheme) \ + list_for_each_entry_safe(f, next, &(scheme)->ops_filters, list) + #ifdef CONFIG_DAMON =20 struct damon_region *damon_new_region(unsigned long start, unsigned long e= nd); diff --git a/mm/damon/core.c b/mm/damon/core.c index 38f545fea585..bcb7e42098dc 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -374,6 +374,7 @@ struct damos *damon_new_scheme(struct damos_access_patt= ern *pattern, */ scheme->next_apply_sis =3D 0; INIT_LIST_HEAD(&scheme->filters); + INIT_LIST_HEAD(&scheme->ops_filters); scheme->stat =3D (struct damos_stat){}; INIT_LIST_HEAD(&scheme->list); =20 --=20 2.39.5 From nobody Tue Dec 16 23:25:35 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6D3014831E; Thu, 27 Feb 2025 01:58:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621483; cv=none; b=qBzbSOKDKGPXACMxPfT2iViDzddkwL1uhCNOXNsCwXZ/fEpZefbo+sOTF+NB2gX6KW/UbEvHHtGWqjdtJFQukxn9qtZNpsUDQiXnlYQep/jFU8G6VYleKsOAt1LOXA/Nxs/JWK1jJNRGxdSIpezm8P3Q/aedGkLSzXrUAGEPA9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621483; c=relaxed/simple; bh=N/YtlGcWQ2PX0NMUIcuI8F7U0I6DV10Xf2TomWII3qk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eSc8pwBMJBV5bTzlF+sldvUa4114xUsspHxxmF2OPCfm7UlJlQInLmUHkFN3nDZkpx65DLL9M+aJ2xXc5x2hqb0EcEBGN84OAWwyJ97Lxq34EbMPjqDUA4ahogZpJcEaafjIFHFPm2FlrnPA0dTyt5ux/PsOTzHe2RkbpKsc7oI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t1dUbAnf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t1dUbAnf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 079F0C4CEE2; Thu, 27 Feb 2025 01:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621483; bh=N/YtlGcWQ2PX0NMUIcuI8F7U0I6DV10Xf2TomWII3qk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t1dUbAnfFVOaSAla8yVUEws7sBVMN8BWmcjrpG4/6zKUr56c2+Hgd9MoRMyC7DcE+ 6eGzAOyhCaUMviM/3vJ6pFMlhbeVEg0jemrvzo/Edm7SrN+agFMW3fwmoaD8xrBMCb y7myLvuuU+3pID+CqtewZT+vjo/3aVeHbqEfBFYBwPOtkvlOU4QRFJTIjadPYKnENr 6ApnqsgnyiFci4rNtMiRv3JMog+qrrRbMV97PHlfoj47WicQ5NnM7xlL0uLEcC4gdy mlnjVmdd05ZDzVmcEC4jVaF/tjnP4RwkquBCakk3frYFaDAsRPoLacw0Zizdu3dQl8 /J+2uSXbBzwDg== 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 v2 2/9] mm/damon/paddr: support ops_filters Date: Wed, 26 Feb 2025 17:57:47 -0800 Message-Id: <20250227015754.38789-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250227015754.38789-1-sj@kernel.org> References: <20250227015754.38789-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" DAMON keeps all DAMOS filters in damos->filters. No filter is saved in damos->ops_filters, but upcoming changes will make it to use damos->ops_filters to have all operations layer handled DAMOS filters. DAMON physical address space operations set implementation (paddr) is not ready for the changes, since it handles only damos->filters. To avoid any breakage during the upcoming changes, make paddr to handle both lists. After the change is made, ->filters support on paddr can be safely removed. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 25090230da17..3e651308ba5d 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -257,6 +257,10 @@ static bool damos_pa_filter_out(struct damos *scheme, = struct folio *folio) if (damos_pa_filter_match(filter, folio)) return !filter->allow; } + damos_for_each_ops_filter(filter, scheme) { + if (damos_pa_filter_match(filter, folio)) + return !filter->allow; + } return false; } =20 @@ -287,6 +291,12 @@ static unsigned long damon_pa_pageout(struct damon_reg= ion *r, struct damos *s, break; } } + damos_for_each_ops_filter(filter, s) { + if (filter->type =3D=3D DAMOS_FILTER_TYPE_YOUNG) { + install_young_filter =3D false; + break; + } + } if (install_young_filter) { filter =3D damos_new_filter( DAMOS_FILTER_TYPE_YOUNG, true, false); @@ -535,6 +545,8 @@ static bool damon_pa_scheme_has_filter(struct damos *s) =20 damos_for_each_filter(f, s) return true; + damos_for_each_ops_filter(f, s) + return true; return false; } =20 --=20 2.39.5 From nobody Tue Dec 16 23:25:35 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D47E414F9EB; Thu, 27 Feb 2025 01:58:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621484; cv=none; b=Ubv+SqkzJspYDFRKgCs+fEdHW6gFKBZNqzlxQnrdm/YqC3JKK+xjUyujUfg17Eg7bggypr46+KGzYZED+BcX44amReQ6UdtEFjnMQO3YrbMH7mqFXsgRQoMA6IdyveYuydSGX8LViAm43zhAiSoiSQ0NxXYQMkJ2BGvhB6DWyiw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621484; c=relaxed/simple; bh=QU2B5OyjwKcbSYOittkRG8TZWYJnF6pYkD/57XDdhdI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FYXv5dIv22EshQfeHESddEctnUQoUY5NGcP2Jg+ZM3Q07AtFzThNOtFFnbUxmVR1VXC3hiVASG+jT9EjqTWWmfbYS8pYiSV/fHhvB5P7nPEZ5L/85pv7qEPNWV/Q3m8M+0QDf0CsWqc/95EhsCbpP/3N1/+m+5yRgG4WYaRShpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VwgPPSnP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VwgPPSnP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29670C4CEE9; Thu, 27 Feb 2025 01:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621484; bh=QU2B5OyjwKcbSYOittkRG8TZWYJnF6pYkD/57XDdhdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VwgPPSnPJQDwc1rIVc7Xx2E+0web9XOgqArVd0SNog172cRGHzVZOVlDqmVdLin2W LLsafYJZIObPHyBR6FtPy4GXobvAx8bDPgoGmKOGbheMalJLOqEE918Ys1Im19RAJr JevxJ/CifsvJqnzMdjGmHnLGcLPhbCTTf16UlCnfOYY0W38Xd/1/LRfTVgvb5ayGz2 56Jeu70HfrlQE6odKGESqBShUS90gYBpYtNoZ2RggUBGgjr6YixIBqOrs3/vDKLQqh I/aIY0swcGT3PSWadD7IY26Rdf/eM8lGHeiaw/YXahxPhvcfCf8KJZkNC3VlkHdkhg XQJUfC8DLYF5Q== 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 v2 3/9] mm/damon/core: support committing ops_filters Date: Wed, 26 Feb 2025 17:57:48 -0800 Message-Id: <20250227015754.38789-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250227015754.38789-1-sj@kernel.org> References: <20250227015754.38789-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" DAMON kernel API callers should use damon_commit_ctx() to install DAMON parameters including DAMOS filters. But damos_commit_ops_filters(), which is called by damon_commit_ctx() for filters installing, is not handling damos->ops_filters. Hence, no DAMON kernel API caller can use damos->ops_filters. Do the committing of the ops_filters to make it usable. Signed-off-by: SeongJae Park --- mm/damon/core.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index bcb7e42098dc..ffdd84ff6fa5 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -793,7 +793,7 @@ static void damos_commit_filter( damos_commit_filter_arg(dst, src); } =20 -static int damos_commit_filters(struct damos *dst, struct damos *src) +static int damos_commit_core_filters(struct damos *dst, struct damos *src) { struct damos_filter *dst_filter, *next, *src_filter, *new_filter; int i =3D 0, j =3D 0; @@ -821,6 +821,44 @@ static int damos_commit_filters(struct damos *dst, str= uct damos *src) return 0; } =20 +static int damos_commit_ops_filters(struct damos *dst, struct damos *src) +{ + struct damos_filter *dst_filter, *next, *src_filter, *new_filter; + int i =3D 0, j =3D 0; + + damos_for_each_ops_filter_safe(dst_filter, next, dst) { + src_filter =3D damos_nth_filter(i++, src); + if (src_filter) + damos_commit_filter(dst_filter, src_filter); + else + damos_destroy_filter(dst_filter); + } + + damos_for_each_ops_filter_safe(src_filter, next, src) { + if (j++ < i) + continue; + + new_filter =3D damos_new_filter( + src_filter->type, src_filter->matching, + src_filter->allow); + if (!new_filter) + return -ENOMEM; + damos_commit_filter_arg(new_filter, src_filter); + damos_add_filter(dst, new_filter); + } + return 0; +} + +static int damos_commit_filters(struct damos *dst, struct damos *src) +{ + int err; + + err =3D damos_commit_core_filters(dst, src); + if (err) + return err; + return damos_commit_ops_filters(dst, src); +} + static struct damos *damon_nth_scheme(int n, struct damon_ctx *ctx) { struct damos *s; --=20 2.39.5 From nobody Tue Dec 16 23:25:35 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6645156F4A; Thu, 27 Feb 2025 01:58:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621485; cv=none; b=PZnMenTymPJHSsUFZCOUZrL/5MB3uT0Com/Rc94825jzRZcAsjVco7PhNWpOKVAo1Y13Zi75dGyLVgnX42aL6JVva/GlVZsJMYB296exEFeDPfaiOclzaGjOJi1IJPu/SR7mDIoTcKB7XT+RAwQhGQMyipJKjm4ndQFrUKoIzQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621485; c=relaxed/simple; bh=OY2pEDCzd2TBvXbxWW+MmytpNlwQ/v7G6etRGptJ9HI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o5yv41J2eXIYTR/82wW6/uU6um4vQSJcy1h0QJDalZBS2iBMrZj1f3+L3vq7OTk+o1UUo96D+4wSdpb1InQxgPFW4bKJu8/0sMAr7iQU71faKxR6Z8BWkWgL69tatRc2+YZKrXMMScrixUajSFBKPhHoY44zDrMqJisqidQiNmw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Qdx3MU9a; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qdx3MU9a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D125C4CEED; Thu, 27 Feb 2025 01:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621485; bh=OY2pEDCzd2TBvXbxWW+MmytpNlwQ/v7G6etRGptJ9HI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qdx3MU9aQ+jtJ3yV54gUkfbBPGrqz/FdGkQ5upGuZlS2dfhhuVbV3LJb5lPg2TI9d tlpr0IlquKAzhEa3FPyi5IUCsODvs40GI9mOzW3gQjQWU8TwYRKSxSx7LPfiz6VHIz a5ok4PeVaVKD+SpVl4aBWh9CaXqHoeozY9FyxbDusP6KnDB5p+UMwQX436msGyG5Io 4DLw+kZ7PUwkiRftIC/cFoE46dhnLc997RWk6XfyMUHZTGfhW+sLMKyxrAuF0vx1IE feM8bPwk59P5sSwIXepLSJ7cKH2is5XnwK45Wav8Ig79KwPj2LzANJNq3nJEExvYwV mC8/gsT/34R8g== 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 v2 4/9] mm/damon/core: put ops-handled filters to damos->ops_filters Date: Wed, 26 Feb 2025 17:57:49 -0800 Message-Id: <20250227015754.38789-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250227015754.38789-1-sj@kernel.org> References: <20250227015754.38789-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" damos->ops_filters has introduced to be used for all operations layer handled filters. But DAMON kernel API callers can put any type of DAMOS filters to any of damos->filters and damos->ops_filters. DAMON user-space ABI users have no way to use ->ops_filters at all. Update damos_add_filter(), which should be used by API callers to install DAMOS filters, to given filters to ->filters and ->ops_filters depending on their handling layer. The change forces both API callers and ABI users to use proper lists since ABI users use the API internally. Signed-off-by: SeongJae Park --- mm/damon/core.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index ffdd84ff6fa5..78126a5145fd 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -281,9 +281,24 @@ struct damos_filter *damos_new_filter(enum damos_filte= r_type type, return filter; } =20 +static bool damos_filter_for_ops(enum damos_filter_type type) +{ + switch (type) { + case DAMOS_FILTER_TYPE_ADDR: + case DAMOS_FILTER_TYPE_TARGET: + return false; + default: + break; + } + return true; +} + void damos_add_filter(struct damos *s, struct damos_filter *f) { - list_add_tail(&f->list, &s->filters); + if (damos_filter_for_ops(f->type)) + list_add_tail(&f->list, &s->ops_filters); + else + list_add_tail(&f->list, &s->filters); } =20 static void damos_del_filter(struct damos_filter *f) --=20 2.39.5 From nobody Tue Dec 16 23:25:35 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4780F17333F; Thu, 27 Feb 2025 01:58:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621487; cv=none; b=WJhB5a+dn2yWSijOZndVywmQygxaYR20/rNKALhUu2qWuXIQOnuxdYDpOCgy2yKBC6p8qKDKzQdWYn3033bhXOtnqcazV7IPjK6o8UxyUuczGL9xbPJ9eP0qPTg2N60VhXD1vN6aIO6UocX1yko9+x7n52iWhKYzUOWh3Z/0YY8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621487; c=relaxed/simple; bh=uM1uKPmHuTy5pB3aPnhpc/7ev2gt12cM7i26onsayOs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QWPEsKqc8fALNKUBjeBDI5F/Sx1Z6tT2+BDQQLzODPbcxeYNfXoz+55c0KC9DGtdJMU2HKPzAoAT6cZFNYUSUSsxtaDC8fJBDfrsUH1LYIpiGpiLiZhCdqa17B6uoiVxhksMFd/TXNXv0FYJvTVnEWVd3pBD7ixEMkcLyfB3TGA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tg510x5K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tg510x5K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96B48C4CEE2; Thu, 27 Feb 2025 01:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621486; bh=uM1uKPmHuTy5pB3aPnhpc/7ev2gt12cM7i26onsayOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tg510x5Knaqgx/5rbI29YLeqJ09i5IxQbxlBnCdce0+KaJQ05TqNa9e3eG3y86gB/ tsqn9Wu39k12aa5QoBNX3awpzJoN42ffPh5euGJrJnoEAg3fN7jKJVpilXVBoH97wa 6dQ5JIi4VZdw90XP3DpK/06W4NrnRymTYvjTNV1QQ4jVn/m+u2R1N33PjulAHdMiGP HWcjfaxiU7wvtWAhrSadi0RgQ628vApLEZYNwf1I3ITjhYmhaMIKjUZw9XRiqRoe12 YfuT6BfzY4HSgakp0hhr7K82dL9IGJHxoj4zWFBL6ejGqDvb/fsR4tWOprqiRg5D5m +AyZggXXK9PcQ== 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 v2 5/9] mm/damon/paddr: support only damos->ops_filters Date: Wed, 26 Feb 2025 17:57:50 -0800 Message-Id: <20250227015754.38789-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250227015754.38789-1-sj@kernel.org> References: <20250227015754.38789-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" DAMON physical address space operation set implementation (paddr) started handling both ->filters and ->ops_filters to avoid breakage during the change for the ->ops_filters setup. Now the change is done, so paddr's support of ->filters is a waste that can safely dropped. Remove it. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 3e651308ba5d..432ea4efdc4b 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -253,10 +253,6 @@ static bool damos_pa_filter_out(struct damos *scheme, = struct folio *folio) { struct damos_filter *filter; =20 - damos_for_each_filter(filter, scheme) { - if (damos_pa_filter_match(filter, folio)) - return !filter->allow; - } damos_for_each_ops_filter(filter, scheme) { if (damos_pa_filter_match(filter, folio)) return !filter->allow; @@ -285,12 +281,6 @@ static unsigned long damon_pa_pageout(struct damon_reg= ion *r, struct damos *s, struct folio *folio; =20 /* check access in page level again by default */ - damos_for_each_filter(filter, s) { - if (filter->type =3D=3D DAMOS_FILTER_TYPE_YOUNG) { - install_young_filter =3D false; - break; - } - } damos_for_each_ops_filter(filter, s) { if (filter->type =3D=3D DAMOS_FILTER_TYPE_YOUNG) { install_young_filter =3D false; @@ -543,8 +533,6 @@ static bool damon_pa_scheme_has_filter(struct damos *s) { struct damos_filter *f; =20 - damos_for_each_filter(f, s) - return true; damos_for_each_ops_filter(f, s) return true; return false; --=20 2.39.5 From nobody Tue Dec 16 23:25:35 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C6C817A305; Thu, 27 Feb 2025 01:58:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621488; cv=none; b=Y+4xNoTrNEDRS+Ky3x1KKY1Ae7iHbbtPYhEVzg0vD0QU/HVdxDzLaBmoXW2G+L82lTBYWqxbhHk3I3LZG1WztUd6xjppiFvn0jKevQUWfzZx3hdryYDveXjRWr/W5utvRm0Ontw/b9FfouG5t2kQNRxbzVfR55yB3FJb8cZFt84= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621488; c=relaxed/simple; bh=S9XFinRzq8Qckj8OZ3J96suStAifVelwVdFkfT6lwsE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pl8De+r34pl66l0sKkenOuLAIlVDkLzFUQ7NK6sxC1gAv/dvhLC6gu10TsfBZQU7nYMlNlUR3ucmgGXnebeAAz5Kre/jb6rtihRYF0S7SJR9bfUjui4Vt1Fp8ft1R52Ah/mw/ap3XjuM0r85fZh0d1RLmMMVQjQgMFyo+Har0aM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WFg4aUZp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WFg4aUZp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B480AC4CEE9; Thu, 27 Feb 2025 01:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621487; bh=S9XFinRzq8Qckj8OZ3J96suStAifVelwVdFkfT6lwsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WFg4aUZpcvDAJt0FMFBylM4KTG431Bd2TRJeJRv7JGBWoHnrsuUQdQLRTT84gi0aN jSZn4AmmhGfesBe8je+1OKX9QewD8rGm8sTkaO/ueid/QTNyvwT/+bt/E4+QTn49tA F/24IP1GLwnSIyFU6EZq9BzGAlFDJbaacDr4NPETqZ/0IKg9mthPql3jFwtf3NJiJh 6cIwyyXOylr8SoA/vObsNNTb/TsoqtEETIzcj6b/6SQmhJnzD3xykHaiIbr7HlfThh SOyhSqCFz3q+HZKSfR1FkujwGAGN5Pf5yOTLzdgRXwDkOP7mmrJh0MBaBrIl3aOTiK PcaKpNlf9SmUQ== 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 v2 6/9] mm/damon: add default allow/reject behavior fields to struct damos Date: Wed, 26 Feb 2025 17:57:51 -0800 Message-Id: <20250227015754.38789-7-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250227015754.38789-1-sj@kernel.org> References: <20250227015754.38789-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Current default allow/reject behavior of filters handling stage has made before introduction of the allow behavior. For allow-filters usage, it is confusing and inefficient. It is more intuitive to decide the default filtering stage allow/reject behavior as opposite to the last filter's behavior. The decision should be made separately for core and operations layers' filtering stages, since last core layer-handled filter is not really a last filter if there are operations layer handling filters. Keeping separate decisions for the two categories can make the logic simpler. Add fields for storing the two decisions. Signed-off-by: SeongJae Park --- include/linux/damon.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index add82fdc1117..1d8479f57f85 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -497,6 +497,9 @@ struct damos { unsigned long next_apply_sis; /* informs if ongoing DAMOS walk for this scheme is finished */ bool walk_completed; + /* whether to reject core/ops filters umatched regions */ + bool core_filters_default_reject; + bool ops_filters_default_reject; /* public: */ struct damos_quota quota; struct damos_watermarks wmarks; --=20 2.39.5 From nobody Tue Dec 16 23:25:35 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7162A18B495; Thu, 27 Feb 2025 01:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621490; cv=none; b=J7QcLfMZconKtGgaZzJhmCQritHbdqST5ZIaQTE3JPE289G9ZzJR1tbyEmYOS8NoB9qsHL0cqa//EeS2pD1KMacP+mzMXObTle7q+bRKIeQsExlRDBWgC1FuWV1RQeMoZALdDP8HwFdTpYMipozv0UIMWN067vAwq4gjMk2+tAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621490; c=relaxed/simple; bh=o7Tb1fqSTBTcTFBCmPVioCKVuRP26jC84n9gdZN/Nso=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Rmq/SEGtJHccUMnwFOqAJgDAmIp8RrjYb4iCJ1bqDVRdNfwoBj17iV/eJVYsIhXrrDgZJJ36zGwSr0yRv+pb9od3mMMpjr+AoqEecpW5a/sFVF0rHvq3+S6E7xMPLTz7Tnk682Xg7LUPw0j8nZx/kcmNECIcx1bJPgqns4kuguw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RjWj45f8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RjWj45f8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C248FC4CED6; Thu, 27 Feb 2025 01:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621489; bh=o7Tb1fqSTBTcTFBCmPVioCKVuRP26jC84n9gdZN/Nso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RjWj45f8qr9qybW6WhIY7KWi/G9KlZfLpHRUkMdyTAbkuEei4cWOQ3htE9tfpt9yM La6TSblyuWFzAtcsqfzTo//ggqbrT3jquB0NjWz35ZhFhKRT+fcmhqDlWyO44XmENh 1c20ENmIjra3EJ2LCQ7QJheQo8AylmISq4gXx95fJ4NrieksEzbjyuVUQBRp2zClyZ NN/uFghaiRogYtUyrVFzf2AtQKC6tI3kqCXvTa7aNoUKF0pmVRiWz/kzD3wmIj2igS yJvd3XrlexS0UxTYRE2f/3aI4wfT16zwn3fCurB10mcV4wYOpSHMMLFoUkHTaknxgc 5B7O5uX1B4r9Q== 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 v2 7/9] mm/damon/core: set damos_filter default allowance behavior based on installed filters Date: Wed, 26 Feb 2025 17:57:52 -0800 Message-Id: <20250227015754.38789-8-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250227015754.38789-1-sj@kernel.org> References: <20250227015754.38789-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Decide whether to allow or reject by default on core and opertions layer handled filters evaluation stages. It is decided as the opposite of the last installed filter's behavior. If there is no filter at all, allow by default. If there is any operations layer handled filters, core layer's filtering stage sets allowing as the default behavior regardless of the last filter of core layer-handling ones, since the last filter of core layer handled filters in the case is not really the last filter of the entire filtering stage. Also, make the core layer's DAMOS filters handling stage uses the newly set behavior field. Signed-off-by: SeongJae Park --- mm/damon/core.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index 78126a5145fd..8661f64ab1b4 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -864,6 +864,32 @@ static int damos_commit_ops_filters(struct damos *dst,= struct damos *src) return 0; } =20 +/** + * damos_filters_default_reject() - decide whether to reject memory that d= idn't + * match with any given filter. + * @filters: Given DAMOS filters of a group. + */ +static bool damos_filters_default_reject(struct list_head *filters) +{ + struct damos_filter *last_filter; + + if (list_empty(filters)) + return false; + last_filter =3D list_last_entry(filters, struct damos_filter, list); + return last_filter->allow; +} + +static void damos_set_filters_default_reject(struct damos *s) +{ + if (!list_empty(&s->ops_filters)) + s->core_filters_default_reject =3D false; + else + s->core_filters_default_reject =3D + damos_filters_default_reject(&s->filters); + s->ops_filters_default_reject =3D + damos_filters_default_reject(&s->ops_filters); +} + static int damos_commit_filters(struct damos *dst, struct damos *src) { int err; @@ -871,7 +897,11 @@ static int damos_commit_filters(struct damos *dst, str= uct damos *src) err =3D damos_commit_core_filters(dst, src); if (err) return err; - return damos_commit_ops_filters(dst, src); + err =3D damos_commit_ops_filters(dst, src); + if (err) + return err; + damos_set_filters_default_reject(dst); + return 0; } =20 static struct damos *damon_nth_scheme(int n, struct damon_ctx *ctx) @@ -1490,7 +1520,7 @@ static bool damos_filter_out(struct damon_ctx *ctx, s= truct damon_target *t, if (damos_filter_match(ctx, t, r, filter)) return !filter->allow; } - return false; + return s->core_filters_default_reject; } =20 /* --=20 2.39.5 From nobody Tue Dec 16 23:25:35 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22E9B187FEC; Thu, 27 Feb 2025 01:58:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621490; cv=none; b=FQ6mCaIJ/DuKwcjSaqEa3OPUhXMpYPWgXiXEcqc+Dd5xrRJp2vMOjzn6Xdc2uN3wJkPqJjulkilCDO0cIa+gbVyIbGcYeqlfpOd1VKMOQgONbPUZeKbSKwXxFuo4WFADctKDdyTLgRtZFlIRM6/WBV4TI/cYh2drxwUj7/Y7rE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621490; c=relaxed/simple; bh=5EkDSCqQcPc4o5HB4towhIerpdJDJgqyUQWBno/4/Pc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VY7mfMfz+nuerfKgE/XQnXXjnp8udOXul4x6yyW2XsdPWBMnAVP3e14GOSZ9rx2cYIovEGzxI5BpBAuA5D9lbz/U8fdXv7Wlc5/0Sa5BqlslALi0g1u2qW85DqiPSl1LaO51gC6fGFNxnpzf3MW2gwxDw7pL5jk6eRvDoHwJBHc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TDxU2T+f; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TDxU2T+f" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1DEDC4CEE8; Thu, 27 Feb 2025 01:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621490; bh=5EkDSCqQcPc4o5HB4towhIerpdJDJgqyUQWBno/4/Pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TDxU2T+fb1Lu8ku+Akhya8vo641/KoP0MnyQgPo0COrZXXJxSODx8ZPMPT/8/JWiY Qw5nEETyG1lvk2ANCOBqu0EPYsqsxFVnrL1JefU78M75Jtdkb5ySvMkEJxQzs2xAEl erL9Cnz1H+8q9AAe14/LG5wJDr7YqcVIctO4HIUD1rq0wl4fNrHocT41y9XIHnYnrL LsO/TA49RXhUn+jCEMyE5iE7B6JM4VDwmODLUy9xF9vqoKJl+qztmcgo9Hywnq5auD 6W4m0xhWcIZ0G5zYqHY61r9bC1FBzJBtnln8ZRdvDGUd16d1yCuP9/nMdpY6RU8i/6 VDt8wh5DSc79w== 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 v2 8/9] mm/damon/paddr: respect ops_filters_default_reject Date: Wed, 26 Feb 2025 17:57:53 -0800 Message-Id: <20250227015754.38789-9-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250227015754.38789-1-sj@kernel.org> References: <20250227015754.38789-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use damos->ops_filters_default_reject, which is set based on the installed filters' behaviors, from physical address space DAMON operations set. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 432ea4efdc4b..fee66a3cc82b 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -257,7 +257,7 @@ static bool damos_pa_filter_out(struct damos *scheme, s= truct folio *folio) if (damos_pa_filter_match(filter, folio)) return !filter->allow; } - return false; + return scheme->ops_filters_default_reject; } =20 static bool damon_pa_invalid_damos_folio(struct folio *folio, struct damos= *s) --=20 2.39.5 From nobody Tue Dec 16 23:25:35 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B899139E; Thu, 27 Feb 2025 01:58:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621491; cv=none; b=OBWew91s938tykafDuvh8dkYPRsMDa3s786GsviV7bMH4y0f6y/5fgu7kPf03ABi6gc7IDfjsMHpS7eMk6HCCcB4hSsG2HCiBYtVeSgzJ/fQaX8ycVEjq1DhIcdOtOPTLxciuEFmor0jvu7E27lFXBW/vB6JqPkjL6IF3IejPP8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740621491; c=relaxed/simple; bh=tQqSkhuPbb1T5x6cMu4V0N9ePh3tWbcGixS02DkoMHk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PCTV4A8N+lctoB5ruKDNlbfBgmPUBweZiTrRc/cOS9rTVAK9cy8TDlEhMtmW7OyqV3avPbBxU1ZbCkdN0686s9iANkjSgYBj/DEKxdnD2qzTqsf662u2Lx7oMVytQ924kqFqBLmRqHyurCMuC/f7sa9xIozzpMMklOYCXZ6nk9k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YFoEwWOQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YFoEwWOQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E04EEC4CEE8; Thu, 27 Feb 2025 01:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621491; bh=tQqSkhuPbb1T5x6cMu4V0N9ePh3tWbcGixS02DkoMHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFoEwWOQMtYL3tiHZY1Klb9D+0FI6oiHIg3qJP9gQ78IuyJzv7mC4Z5XiRo+eS7nE +X9R8bAUwlgr0l6XZKdzqTkFzZMhmbd/P/Eha3YGAjfIylzddDwrO7+ZyoLTLWifu5 Tu2FKElANpXcF/pdBlIchfNiSWjeMm3yJ1J+d1+450u2LbP2A3i/gN+uwdA4m690lK fMyX5xpGp9iB9GtaAZHtik2A0zQ/Jck7wC2VdhVNvpV4Q2movxtcZQMD9ZdPLGG+TZ rshdBICJI0Y7/Iu2K60V4q/eKP4SucGbQPACyRyshuj2ZwIBdhYJT7S5rtRc7HD2oa 4SoI53OREUdiw== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 9/9] Docs/mm/damon/design: update for changed filter-default behavior Date: Wed, 26 Feb 2025 17:57:54 -0800 Message-Id: <20250227015754.38789-10-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250227015754.38789-1-sj@kernel.org> References: <20250227015754.38789-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update the design documentation for changed DAMOS filters default allowance behaviors. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index 5af991551a86..ffea744e4889 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -581,9 +581,10 @@ When multiple filters are installed, the group of filt= ers that handled by the core layer are evaluated first. After that, the group of filters that han= dled by the operations layer are evaluated. Filters in each of the groups are evaluated in the installed order. If a part of memory is matched to one o= f the -filter, next filters are ignored. If the memory passes through the filters +filter, next filters are ignored. If the part passes through the filters evaluation stage because it is not matched to any of the filters, applying= the -scheme's action to it is allowed, same to the behavior when no filter exis= ts. +scheme's action to it depends on the last filter's allowance type. If the= last +filter was for allowing, the part of memory will be rejected, and vice ver= sa. =20 For example, let's assume 1) a filter for allowing anonymous pages and 2) another filter for rejecting young pages are installed in the order. If a= page @@ -595,11 +596,6 @@ second reject-filter blocks it. If the page is neithe= r anonymous nor young, the page will pass through the filters evaluation stage since there is no matching filter, and the action will be applied to the page. =20 -Note that the action can equally be applied to memory that either explicit= ly -filter-allowed or filters evaluation stage passed. It means that installi= ng -allow-filters at the end of the list makes no practical change but only -filters-checking overhead. - Below ``type`` of filters are currently supported. =20 - Core layer handled --=20 2.39.5