From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796451830; b=clvC3lJP1pTbd4ZooCUuWbvx38eAZPmFt0KmL5GulNRH+1zdP+vVD8Q+ebtrMg7y6YfS RB6UpQZEKipoeU4EE1jzBbfW3cG/DFDHwOfEKvulisYkqoiOwv5gxFkF3Al2jger0ftfz KtLc9REaPnBBjvGUitDrDhPy6qidHsOIFZltJs/7Q7rhP5/1wOPCweFa1M0GmWrPvtxmA Ob56ojhDdPNsuDOrp6kT9qKG2A+XrYbMblwGQ1LHFjUm8aA9kHNeRU//XDESwsmXj3/+Y 151GiHzMzpVQkmcJfNBJXcdmSg1tc6FKA7Syap6ymwdaYg5LleIsFB7rw+4Ceki7s6A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796451830; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=6eAdK9NyCNYV+9kaP3/VaJueuLgbHcczOWXByJTMC6A=; b=TD/Fkwj8s+QZMieFAT03iELIVkfWoEZ6cuwIIbAh7Hr6RZbvcArO5TaLzSSJOeAgh6as 5ixjRc0F6xHG82+8q2sL8yrzZlOmnfHJFXJuepWyZMlUgmMItX2RbdwA03oJ6ZMRwAyR5 QJ3sQeN8L+9G4OFH+fE9DpNJdvKUA+DuAzACr7KfrIlkKW9w5Nq1eGcUoY4h3aS++VN9x hrKJF7fwPqe4euNs6WA2xl/JROxrDHauxLExcTLR78Jlv60WVY+q6BQtHJ+n/Y5L5pwRz SgPcLq1ii7F6UrmqJNIvHY7/3Ye0D3vUqQJn44z2RQEtTqkHcObYR5s81Kb+is9aEPw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b="2RzihZj/"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 628F0606A322 for ; Sat, 5 Dec 2026 06:23:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=2RzihZj/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id D770A1F00936; Sat, 5 Dec 2026 06:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796451830; bh=6eAdK9NyCNYV+9kaP3/VaJueuLgbHcczOWXByJTMC6A=; h=Date:To:From:In-Reply-To:References:Subject; b=2RzihZj/tBhRDz+fpCFHL8x07jL1qP2o2K949BUJgWVdcHg6bXaOmZhloZMVcvLef kaFvF1rcfbU1tqtbE9fdZyp9Ab8YoAeEP+J+0llEcFXh5x/MqlKCvblkYnqG+ELnY8 xp5ydHXdDzV4M/Ycc8XFSIJxizUOXwOeJIW6WU2A= Date: Fri, 04 Dec 2026 22:23:49 -0800 To: mm-commits@vger.kernel.org,sj@kernel.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261204234637.93274-3-sj@kernel.org> References: <20261204234637.93274-3-sj@kernel.org> Subject: + mm-damon-core-apply-damos-core-filter-in-__damos_valid_target.patch added to mm-new branch Message-Id: <20261205062349.D770A1F00936@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/damon/core: apply damos core filter in __damos_valid_target() has been added to the -mm mm-new branch. Its filename is mm-damon-core-apply-damos-core-filter-in-__damos_valid_target.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-core-apply-damos-core-filter-in-__damos_valid_target.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: SJ Park Subject: mm/damon/core: apply damos core filter in __damos_valid_target() Date: Fri, 04 Dec 2026 15:46:34 -0800 DAMOS uses damos_access_pattern as the primary target region selection method. Meanwhile, DAMOS core filters are used as a secondary method. The filters are applied when needed, in addition to damos access pattern check. There is no real reason to keep filters as secondary class. DAMOS core filters are effectively applied on every place that damos_acces_pattern is applied. The node_eligible_mem_bp DAMOS quota goal type handling is the only one exception. Having DAMOS core filters handling in multiple places only makes it easy to add mistakes. Also, probe_hits_wsum DAMOS core filter type is the only method to specify DAMOS target regions with probe_hits. For this reason, core filters become the primary target region selection method in the attributes only monitoring mode. Treat DAMOS core filter as the primary method. Handle core filters and damos_access_pattern together in the central region selection function, __damos_valid_target(). Update __damos_valid_target() to receive damon_target, to be able to apply core filters. The node_eligible_mem_bp DAMOS quota goal type intentionally ignores core filters. Keep the behavior by splitting damos_access_pattern check logic out of __damos_valid_target(), and call it from the quota goal handling. Link: https://patch.msgid.link/20261204234637.93274-3-sj@kernel.org Signed-off-by: SJ Park Signed-off-by: Andrew Morton mm/damon/core.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) --- a/mm/damon/core.c~mm-damon-core-apply-damos-core-filter-in-__damos_valid_target +++ a/mm/damon/core.c @@ -2535,8 +2535,12 @@ static noinline_for_stack void kdamond_t damon_set_attrs(c, &new_attrs); } -static bool __damos_valid_target(struct damon_region *r, struct damos *s, - struct damon_ctx *c) +static bool damos_core_filter_out(struct damon_ctx *ctx, + struct damon_target *t, struct damon_region *r, + struct damos *s); + +static bool damos_access_pattern_eligible(struct damon_region *r, + struct damos *s, struct damon_ctx *c) { unsigned long sz; unsigned int nr_accesses = damon_nr_accesses_mvsum(r, c); @@ -2550,6 +2554,14 @@ static bool __damos_valid_target(struct r->age <= s->pattern.max_age_region; } +static bool __damos_valid_target(struct damon_region *r, struct damos *s, + struct damon_ctx *c, struct damon_target *t) +{ + if (!damos_access_pattern_eligible(r, s, c)) + return false; + return !damos_core_filter_out(c, t, r, s); +} + /* * damos_quota_is_set() - Return if the given quota is actually set. * @quota: The quota to check. @@ -2563,9 +2575,9 @@ static bool damos_quota_is_set(struct da } static bool damos_valid_target(struct damon_ctx *c, struct damon_region *r, - struct damos *s) + struct damos *s, struct damon_target *t) { - bool ret = __damos_valid_target(r, s, c); + bool ret = __damos_valid_target(r, s, c, t); if (!ret || !damos_quota_is_set(&s->quota) || !c->ops.get_scheme_score) return ret; @@ -2896,9 +2908,6 @@ static void damos_apply_scheme(struct da } if (c->ops.apply_scheme) { - if (damos_core_filter_out(c, t, r, s)) - return; - sz = damon_sz_region(r); if (damos_quota_is_set(quota) && quota->charged_sz + sz > quota->esz) { sz = ALIGN_DOWN(quota->esz - quota->charged_sz, @@ -2957,7 +2966,7 @@ static void damon_do_apply_schemes(struc s->max_nr_snapshots <= s->stat.nr_snapshots) continue; - if (damos_valid_target(c, r, s)) + if (damos_valid_target(c, r, s, t)) damos_apply_scheme(c, t, r, s); if (damon_is_last_region(r, t)) @@ -3218,7 +3227,7 @@ static phys_addr_t damos_calc_eligible_b damon_for_each_region(r, t) { phys_addr_t addr, end_addr; - if (!__damos_valid_target(r, s, c)) + if (!damos_access_pattern_eligible(r, s, c)) continue; /* Convert from core address units to physical bytes */ @@ -3565,9 +3574,7 @@ static void damos_adjust_quota(struct da (DAMOS_MAX_SCORE + 1)); damon_for_each_target(t, c) { damon_for_each_region(r, t) { - if (!__damos_valid_target(r, s, c)) - continue; - if (damos_core_filter_out(c, t, r, s)) + if (!__damos_valid_target(r, s, c, t)) continue; score = c->ops.get_scheme_score(c, r, s); c->regions_score_histogram[score] += _ Patches currently in -mm which might be from sj@kernel.org are mm-damon-core-copy-only-installed-probe-in-damon_split_region_at.patch mm-damon-core-add-damos_filter_type_age_ms.patch mm-damon-sysfs-schemes-support-damos_filter_type_age_ms.patch docs-mm-damon-design-update-for-age_ms-damos-core-filter-type.patch docs-admin-guide-mm-damon-usage-update-for-age_ms-damos-core-filter.patch mm-damon-api-define-damon_filter_type_active.patch mm-damon-ops-common-implement-damon_filter_type_active-operation.patch mm-damon-sysfs-support-lru-activeness-based-damon-filter-setup.patch docs-mm-damon-design-update-for-damon_filter_type_active.patch maintainers-change-damon-scm-tree-to-mm-damongit.patch docs-mm-damon-maintainer-profile-use-damongit-for-patch-baselines.patch docs-mm-damon-maintainer-profile-drop-scm-trees-section.patch docs-mm-damon-maintainer-profile-update-key-cycle-dates-for-damongit.patch mm-damon-api-introduce-struct-damon_report.patch mm-damon-core-implement-data-attribute-report-queue.patch mm-damon-core-introduce-damon_submit_report.patch mm-damon-sysfs-add-admin-reports-directory.patch mm-damon-sysfs-add-reports-producers-directory.patch mm-damon-sysfs-add-producers-nr_producers-file.patch mm-damon-sysfs-implement-report-producer-directory.patch mm-damon-sysfs-implement-report-producer-type-and-state-files.patch docs-mm-damon-design-update-for-report-system.patch docs-admin-guide-mm-damon-usage-update-for-report-producer-sysfs.patch docs-abi-damon-update-for-report-producer-sysfs-files.patch mm-damon-core-introduce-damon_filter_type_report_made.patch mm-damon-core-introduce-damon_report_exist.patch mm-damon-paddr-support-report_made-type-probe-filter.patch mm-damon-sysfs-add-filter_report_type-file-under-probe-filter-directory.patch mm-damon-sysfs-support-report_made-type-probe-filter-setup.patch docs-mm-damon-design-update-for-report_made-probe-filter-type.patch docs-admin-guide-mm-damon-usage-update-for-report_made-probe-filter.patch docs-abi-damon-update-for-report_made-probe-filter.patch mm-damon-api-introduce-user_report-report-type.patch mm-damon-sysfs-add-user_report-support-for-report-type-input.patch mm-damon-sysfs-implement-report-producer-addr_startend-files.patch mm-damon-sysfs-implement-submit-command-for-report-producer.patch selftests-damon-sysfssh-add-basic-tests-for-admin-reports.patch docs-mm-damon-design-update-for-user-report-support.patch docs-admin-guide-mm-damon-usage-update-for-user_report-report-support.patch docs-abi-damon-update-for-user_report-report-support.patch mm-damon-sysfs-define-damon_sysfs_cmd_name-type-and-array.patch mm-damon-sysfs-use-damon_sysfs_cmd_names-in-state_store.patch mm-damon-sysfs-use-damon_sysfs_cmd_names-in-state_show.patch mm-damon-sysfs-remove-damon_sysfs_cmd_strs-and-nr_damon_sysfs_cmds.patch mm-damon-kconfig-update-for-features-other-than-access-monitoring.patch mm-damon-kconfig-clarify-kunit-scope-of-kunit-configs.patch mm-damon-vaddr-advance-migration-attempt-in-folio-level-for-filter-out.patch mm-damon-vaddr-use-damos-last_applied-for-migrate-action.patch mm-damon-vaddr-implement-sz_filter_passed-for-migrate_hotcold-action.patch mm-damon-sysfs-schemes-drop-redundant-and-racy-zero-target_value-check.patch selftests-damon-damos_apply_interval-remove-unused-variables.patch selftests-damon-remove-unused-imports-of-sys-and-time-modules.patch mm-damon-update-file-intro-comments-to-call-damon-just-damon.patch mm-damon-core-expose-damon_has_probe_weights.patch mm-damon-ops-common-use-probe-hits-weighted-sum-in-damon_hot_score.patch mm-damon-tests-core-kunit-drop-apply_scheme-internal-filter-tests.patch mm-damon-core-apply-damos-core-filter-in-__damos_valid_target.patch mm-damon-api-clarify-node_eligible_mem_bp-is-access-pattern-eligible.patch