* [RFC PATCH v2.1 0/7] mm/damon: introduce probe_hits_wsum DAMOS core filter
@ 2026-09-10 4:03 SJ Park
2026-09-10 4:03 ` [RFC PATCH v2.1 1/7] mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM SJ Park
` (6 more replies)
0 siblings, 7 replies; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:03 UTC (permalink / raw)
Cc: SJ Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Randy Dunlap, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-mm
DAMON can do flexible data attributes monitoring. The classical data
access monitoring can also be done using the attributes monitoring. The
access event is just one of the data attributes that DAMON supports.
Users do monitoring to make some actions based on it. DAMOS is a
feature for automating that. However, DAMOS cannot utilize the data
attributes monitoring results. It is still Data "Access"
Monitoring-based Operation Schemes. It requires users to set the target
"access" pattern.
DAMOS core filter is effectively the same as the target access pattern.
It is just a more generalized and flexible way of describing the
operation action target region. Introduce a new DAMOS core filter type,
probe_hits_wsum. It specifies the filter target based on a range of the
probe hits weighted sum. Using this, users can apply DAMOS actions to
regions of specific data attributes pattern.
Note that the classic target access pattern still works. Hence the
target nr_accesses range should still be properly configured. The new
filter would be used in only data attributes-only mode. In the mode,
classic access monitoring is just turned off, and therefore nr_accesses
of regions are always zero. Users could simply set the target
nr_accesses range to include the zero nr_Accesses regions.
Patches Sequence
================
Patch 1 updates the DAMON kernel API for the new filter type. Patch 2
extends damon_probe_hits_wsum() to do the calculation based on moving
sum. Patch 3 implements the filter type in the core layer. Patch 4
refactors DAMON sysfs interface internal data structure for efficient
reuse of data structure for the probe hits weighted sum range user
inputs. Patch 5 updates DAMON sysfs interface to support the new filter
type. Patches 6 and 7 update design and usage documents for the new
filter type, respectively.
Changelog
=========
Changes from RFC v2
- RFC v2: https://lore.kernel.org/20260907171218.101430-1-sj@kernel.org
- Rebase to latest mm-new.
Changes from RFC
- RFC: https://lore.kernel.org/20260906210513.106895-1-sj@kernel.org
- Fix kernel-doc typo.
- Use moving sum based weighted sum.
- Fix wrong range saving field names in sysfs.
SJ Park (7):
mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM
mm/damon/core: extend probe_hits_wsum() for moving sum based
calculation
mm/damon/core: support probe_hits_wsum damos core filter
mm/damon/sysfs-schemes: rename sysfs_filter->sz_range to
range_{min,max}
mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter
Docs/mm/damon/design: update for probe_hits_wsum DAMOS core filter
Docs/admin-guide/mm/damon/usage: update for probe_hits_wsum DAMOS
filter
Documentation/admin-guide/mm/damon/usage.rst | 4 +++
Documentation/mm/damon/design.rst | 3 ++
include/linux/damon.h | 10 ++++++-
mm/damon/core.c | 20 +++++++++++--
mm/damon/paddr.c | 2 +-
mm/damon/sysfs-schemes.c | 30 ++++++++++++++------
mm/damon/vaddr.c | 2 +-
7 files changed, 57 insertions(+), 14 deletions(-)
base-commit: 569e5184af6e299ec0e1f44cde89c2c2bb309a9e
--
2.47.3
^ permalink raw reply [flat|nested] 18+ messages in thread
* [RFC PATCH v2.1 1/7] mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM
2026-09-10 4:03 [RFC PATCH v2.1 0/7] mm/damon: introduce probe_hits_wsum DAMOS core filter SJ Park
@ 2026-09-10 4:03 ` SJ Park
2026-09-10 4:13 ` sashiko-bot
2026-09-10 4:03 ` [RFC PATCH v2.1 2/7] mm/damon/core: extend probe_hits_wsum() for moving sum based calculation SJ Park
` (5 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:03 UTC (permalink / raw)
Cc: SJ Park, damon, linux-kernel, linux-mm
Update DAMON kernel API to introduce new DAMOS core filter type,
PROBE_HITS_WSUM. It will allow API callers to describe the DAMOS action
target regions based on their probe_hits weighted sum. For describing
the filtering target weighted sum range, add two type-dependent union
fields to damos_filter.
Signed-off-by: SJ Park <sj@kernel.org>
---
include/linux/damon.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 871d26adf6ae5..1deda16bb70b5 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -399,6 +399,7 @@ struct damos_stat {
* @DAMOS_FILTER_TYPE_UNMAPPED: Unmapped pages.
* @DAMOS_FILTER_TYPE_ADDR: Address range.
* @DAMOS_FILTER_TYPE_TARGET: Data Access Monitoring target.
+ * @DAMOS_FILTER_TYPE_PROBE_HITS_WSUM: probe_hits weighted sum range.
* @NR_DAMOS_FILTER_TYPES: Number of filter types.
*
* All types except &DAMOS_FILTER_TYPE_ADDR and &DAMOS_FILTER_TYPE_TARGET
@@ -420,6 +421,7 @@ enum damos_filter_type {
DAMOS_FILTER_TYPE_UNMAPPED,
DAMOS_FILTER_TYPE_ADDR,
DAMOS_FILTER_TYPE_TARGET,
+ DAMOS_FILTER_TYPE_PROBE_HITS_WSUM,
NR_DAMOS_FILTER_TYPES,
};
@@ -434,6 +436,8 @@ enum damos_filter_type {
* &damon_ctx->adaptive_targets if @type is
* DAMOS_FILTER_TYPE_TARGET.
* @sz_range: Size range if @type is DAMOS_FILTER_TYPE_HUGEPAGE_SIZE.
+ * @range_min: Minimum value of range arguments.
+ * @range_max: Maximum value of range arguments.
*
* Before applying the &damos->action to a memory region, DAMOS checks if each
* byte of the region matches to this given condition and avoid applying the
@@ -450,6 +454,10 @@ struct damos_filter {
struct damon_addr_range addr_range;
int target_idx;
struct damon_size_range sz_range;
+ struct {
+ unsigned long range_min;
+ unsigned long range_max;
+ };
};
/* private: */
/* List head for siblings. */
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFC PATCH v2.1 2/7] mm/damon/core: extend probe_hits_wsum() for moving sum based calculation
2026-09-10 4:03 [RFC PATCH v2.1 0/7] mm/damon: introduce probe_hits_wsum DAMOS core filter SJ Park
2026-09-10 4:03 ` [RFC PATCH v2.1 1/7] mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM SJ Park
@ 2026-09-10 4:03 ` SJ Park
2026-09-10 4:08 ` sashiko-bot
2026-09-10 4:03 ` [RFC PATCH v2.1 3/7] mm/damon/core: support probe_hits_wsum damos core filter SJ Park
` (4 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:03 UTC (permalink / raw)
Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm
damon_probe_hits_wsum() is being called only in aggregation time. In
future, it could also be used by DAMOS. In this case, since DAMOS uses
its own apply_interval, it could be called in sampling time. Then using
the not yet fully aggregated probe_hits could result in suboptimum
outcomes. Extend damon_probe_hits_wsum() to get the weighted sum based
on moving sum to prepare the DAMOS usage.
Signed-off-by: SJ Park <sj@kernel.org>
---
include/linux/damon.h | 2 +-
mm/damon/core.c | 8 ++++++--
mm/damon/paddr.c | 2 +-
mm/damon/vaddr.c | 2 +-
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 1deda16bb70b5..9fa99f92a2e94 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -1073,7 +1073,7 @@ unsigned int damon_nr_accesses_mvsum(struct damon_region *r,
struct damon_ctx *ctx);
unsigned char damon_probe_hits_mvsum(int probe_idx, struct damon_region *r,
struct damon_ctx *ctx);
-unsigned int damon_probe_hits_wsum(struct damon_region *r, bool last,
+unsigned int damon_probe_hits_wsum(struct damon_region *r, bool last, bool mv,
struct damon_ctx *ctx);
int damon_set_regions(struct damon_target *t, struct damon_addr_range *ranges,
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 06cf2ab7e97d7..50e0f9407db2b 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -469,11 +469,12 @@ static bool damon_is_last_region(struct damon_region *r,
* damon_probe_hits_wsum() - Returns probe hits weighted sum of a region.
* @r: region to get the weighted sum of.
* @last: if the request is for last-window aggregated probe hits.
+ * @mv: use moving sum.
* @ctx: context of &r.
*
* Return: the weighted sum of probe hits of the region.
*/
-unsigned int damon_probe_hits_wsum(struct damon_region *r, bool last,
+unsigned int damon_probe_hits_wsum(struct damon_region *r, bool last, bool mv,
struct damon_ctx *ctx)
{
struct damon_probe *probe;
@@ -483,6 +484,9 @@ unsigned int damon_probe_hits_wsum(struct damon_region *r, bool last,
damon_for_each_probe(probe, ctx) {
if (last)
sum += r->last_probe_hits[i++] * probe->weight;
+ else if (mv)
+ sum += damon_probe_hits_mvsum(i++, r, ctx) *
+ probe->weight;
else
sum += r->probe_hits[i++] * probe->weight;
}
@@ -3456,7 +3460,7 @@ static unsigned int damon_merge_score(struct damon_region *r, bool last,
struct damon_ctx *ctx, bool use_probe_hits)
{
if (use_probe_hits)
- return damon_probe_hits_wsum(r, last, ctx);
+ return damon_probe_hits_wsum(r, last, false, ctx);
if (last)
return r->last_nr_accesses;
return r->nr_accesses;
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index d7c81829445ba..b8f4d28165dd7 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -202,7 +202,7 @@ static unsigned int damon_pa_apply_probes(struct damon_ctx *ctx,
folio_put(folio);
if (return_max_wsum)
max_wsum = max(damon_probe_hits_wsum(r, false,
- ctx), max_wsum);
+ false, ctx), max_wsum);
}
}
return max_wsum;
diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index 9a38dc89a156e..4aecf34e39be2 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -704,7 +704,7 @@ static unsigned int damon_va_apply_probes(struct damon_ctx *ctx,
__damon_va_apply_probes(ctx, mm, r);
if (return_max_wsum)
max_wsum = max(damon_probe_hits_wsum(r, false,
- ctx), max_wsum);
+ false, ctx), max_wsum);
}
if (mm)
mmput(mm);
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFC PATCH v2.1 3/7] mm/damon/core: support probe_hits_wsum damos core filter
2026-09-10 4:03 [RFC PATCH v2.1 0/7] mm/damon: introduce probe_hits_wsum DAMOS core filter SJ Park
2026-09-10 4:03 ` [RFC PATCH v2.1 1/7] mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM SJ Park
2026-09-10 4:03 ` [RFC PATCH v2.1 2/7] mm/damon/core: extend probe_hits_wsum() for moving sum based calculation SJ Park
@ 2026-09-10 4:03 ` SJ Park
2026-09-10 4:16 ` sashiko-bot
2026-09-10 4:03 ` [RFC PATCH v2.1 4/7] mm/damon/sysfs-schemes: rename sysfs_filter->sz_range to range_{min,max} SJ Park
` (3 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:03 UTC (permalink / raw)
Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm
Implement probe_hits_wsum DAMOS core filter support in the core layer.
Make three small changes for the support. First, update
damos_filter_for_ops() to treat probe_hits_wsum filter as core filter.
Second, Update destination damos_filter->range_{min,max} for
probe_hits_wsum type damos filter commits. Third, extend
damos_filter_match() to handle probe_hits_wsum type filter. Calculate
the weighted sum of the given region and compare it with the given
filter's target weighted sum range.
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/core.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 50e0f9407db2b..0c98f7e267d07 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -658,6 +658,7 @@ bool damos_filter_for_ops(enum damos_filter_type type)
switch (type) {
case DAMOS_FILTER_TYPE_ADDR:
case DAMOS_FILTER_TYPE_TARGET:
+ case DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
return false;
default:
break;
@@ -1332,6 +1333,10 @@ static void damos_commit_filter_arg(
case DAMOS_FILTER_TYPE_HUGEPAGE_SIZE:
dst->sz_range = src->sz_range;
break;
+ case DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
+ dst->range_min = src->range_min;
+ dst->range_max = src->range_max;
+ break;
default:
break;
}
@@ -2510,7 +2515,7 @@ static bool damos_filter_match(struct damon_ctx *ctx, struct damon_target *t,
bool matched = false;
struct damon_target *ti;
int target_idx = 0;
- unsigned long start, end;
+ unsigned long start, end, wsum;
switch (filter->type) {
case DAMOS_FILTER_TYPE_TARGET:
@@ -2545,6 +2550,11 @@ static bool damos_filter_match(struct damon_ctx *ctx, struct damon_target *t,
damon_split_region_at(t, r, end - r->ar.start);
matched = true;
break;
+ case DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
+ wsum = damon_probe_hits_wsum(r, false, true, ctx);
+ matched = filter->range_min <= wsum &&
+ wsum <= filter->range_max;
+ break;
default:
return false;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFC PATCH v2.1 4/7] mm/damon/sysfs-schemes: rename sysfs_filter->sz_range to range_{min,max}
2026-09-10 4:03 [RFC PATCH v2.1 0/7] mm/damon: introduce probe_hits_wsum DAMOS core filter SJ Park
` (2 preceding siblings ...)
2026-09-10 4:03 ` [RFC PATCH v2.1 3/7] mm/damon/core: support probe_hits_wsum damos core filter SJ Park
@ 2026-09-10 4:03 ` SJ Park
2026-09-10 4:14 ` sashiko-bot
2026-09-10 4:03 ` [RFC PATCH v2.1 5/7] mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter SJ Park
` (2 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:03 UTC (permalink / raw)
Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm
DAMON sysfs interface provides 'min' and 'max' files under the DAMOS
filter directory. The purpose is setting the general range arguments
for hugepage_size like filters that require range arguments. So far,
hugepage_size was the only filter using it. Hence sz_range field of
damon_sysfs_scheme_filter struct was connected to the files.
In future, we could add a new filter that can reuse the 'min' and 'max'
files. And the filter might use a range of a type that is not size. For
example, probe_hits weighted sum. In this case, simply reusing the
sz_range field would make it a little confusing. Rename sz_range to
range_{min,max} to avoid such confusion.
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/sysfs-schemes.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index d9b81d7b5910e..4d9147d2a269e 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -534,7 +534,8 @@ struct damon_sysfs_scheme_filter {
bool allow;
char *memcg_path;
struct damon_addr_range addr_range;
- struct damon_size_range sz_range;
+ unsigned long range_min;
+ unsigned long range_max;
int target_idx;
};
@@ -588,6 +589,7 @@ damos_sysfs_filter_type_names[] = {
.type = DAMOS_FILTER_TYPE_TARGET,
.name = "target",
},
+
};
static ssize_t type_show(struct kobject *kobj,
@@ -778,7 +780,7 @@ static ssize_t min_show(struct kobject *kobj,
struct damon_sysfs_scheme_filter *filter = container_of(kobj,
struct damon_sysfs_scheme_filter, kobj);
- return sysfs_emit(buf, "%lu\n", filter->sz_range.min);
+ return sysfs_emit(buf, "%lu\n", filter->range_min);
}
static ssize_t min_store(struct kobject *kobj,
@@ -786,7 +788,7 @@ static ssize_t min_store(struct kobject *kobj,
{
struct damon_sysfs_scheme_filter *filter = container_of(kobj,
struct damon_sysfs_scheme_filter, kobj);
- int err = kstrtoul(buf, 0, &filter->sz_range.min);
+ int err = kstrtoul(buf, 0, &filter->range_min);
return err ? err : count;
}
@@ -797,7 +799,7 @@ static ssize_t max_show(struct kobject *kobj,
struct damon_sysfs_scheme_filter *filter = container_of(kobj,
struct damon_sysfs_scheme_filter, kobj);
- return sysfs_emit(buf, "%lu\n", filter->sz_range.max);
+ return sysfs_emit(buf, "%lu\n", filter->range_max);
}
static ssize_t max_store(struct kobject *kobj,
@@ -805,7 +807,7 @@ static ssize_t max_store(struct kobject *kobj,
{
struct damon_sysfs_scheme_filter *filter = container_of(kobj,
struct damon_sysfs_scheme_filter, kobj);
- int err = kstrtoul(buf, 0, &filter->sz_range.max);
+ int err = kstrtoul(buf, 0, &filter->range_max);
return err ? err : count;
}
@@ -2835,12 +2837,13 @@ static int damon_sysfs_add_scheme_filters(struct damos *scheme,
} else if (filter->type == DAMOS_FILTER_TYPE_TARGET) {
filter->target_idx = sysfs_filter->target_idx;
} else if (filter->type == DAMOS_FILTER_TYPE_HUGEPAGE_SIZE) {
- if (sysfs_filter->sz_range.min >
- sysfs_filter->sz_range.max) {
+ if (sysfs_filter->range_min >
+ sysfs_filter->range_max) {
damos_destroy_filter(filter);
return -EINVAL;
}
- filter->sz_range = sysfs_filter->sz_range;
+ filter->sz_range.min = sysfs_filter->range_min;
+ filter->sz_range.max = sysfs_filter->range_max;
}
damos_add_filter(scheme, filter);
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFC PATCH v2.1 5/7] mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter
2026-09-10 4:03 [RFC PATCH v2.1 0/7] mm/damon: introduce probe_hits_wsum DAMOS core filter SJ Park
` (3 preceding siblings ...)
2026-09-10 4:03 ` [RFC PATCH v2.1 4/7] mm/damon/sysfs-schemes: rename sysfs_filter->sz_range to range_{min,max} SJ Park
@ 2026-09-10 4:03 ` SJ Park
2026-09-10 4:18 ` sashiko-bot
2026-09-10 4:03 ` [RFC PATCH v2.1 6/7] Docs/mm/damon/design: update for probe_hits_wsum DAMOS " SJ Park
2026-09-10 4:03 ` [RFC PATCH v2.1 7/7] Docs/admin-guide/mm/damon/usage: update for probe_hits_wsum DAMOS filter SJ Park
6 siblings, 1 reply; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:03 UTC (permalink / raw)
Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm
Extend DAMON sysfs interface to support probe_hits_wsum input. Also
update sysfs input based scheme build logic to setup the min/max probe
hits weighted sum range as user provided.
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/sysfs-schemes.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index 4d9147d2a269e..d9dd4ee0442c7 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -589,7 +589,10 @@ damos_sysfs_filter_type_names[] = {
.type = DAMOS_FILTER_TYPE_TARGET,
.name = "target",
},
-
+ {
+ .type = DAMOS_FILTER_TYPE_PROBE_HITS_WSUM,
+ .name = "probe_hits_wsum",
+ },
};
static ssize_t type_show(struct kobject *kobj,
@@ -2844,6 +2847,14 @@ static int damon_sysfs_add_scheme_filters(struct damos *scheme,
}
filter->sz_range.min = sysfs_filter->range_min;
filter->sz_range.max = sysfs_filter->range_max;
+ } else if (filter->type == DAMOS_FILTER_TYPE_PROBE_HITS_WSUM) {
+ if (sysfs_filter->range_min >
+ sysfs_filter->range_max) {
+ damos_destroy_filter(filter);
+ return -EINVAL;
+ }
+ filter->range_min = sysfs_filter->range_min;
+ filter->range_max = sysfs_filter->range_max;
}
damos_add_filter(scheme, filter);
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFC PATCH v2.1 6/7] Docs/mm/damon/design: update for probe_hits_wsum DAMOS core filter
2026-09-10 4:03 [RFC PATCH v2.1 0/7] mm/damon: introduce probe_hits_wsum DAMOS core filter SJ Park
` (4 preceding siblings ...)
2026-09-10 4:03 ` [RFC PATCH v2.1 5/7] mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter SJ Park
@ 2026-09-10 4:03 ` SJ Park
2026-09-10 4:05 ` sashiko-bot
2026-09-10 4:03 ` [RFC PATCH v2.1 7/7] Docs/admin-guide/mm/damon/usage: update for probe_hits_wsum DAMOS filter SJ Park
6 siblings, 1 reply; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:03 UTC (permalink / raw)
Cc: SJ Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Randy Dunlap, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-mm
Update DAMON design document for the newly added probe hits weighted sum
based DAMOS core filter type.
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/mm/damon/design.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index aac84de261aa8..8e980dde362de 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -822,6 +822,9 @@ Below ``type`` of filters are currently supported.
- Applied to pages that belonging to a given address range.
- target
- Applied to pages that belonging to a given DAMON monitoring target.
+ - probe_hits_wsum
+ - Matches to monitoring regions having a given range of :ref:`probe
+ hits weighted sum <damon_design_attrs_only_monitoring>` value.
- Operations layer handled, supported by only ``paddr`` operations set.
- anon
- Applied to pages that containing data that not stored in files.
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [RFC PATCH v2.1 7/7] Docs/admin-guide/mm/damon/usage: update for probe_hits_wsum DAMOS filter
2026-09-10 4:03 [RFC PATCH v2.1 0/7] mm/damon: introduce probe_hits_wsum DAMOS core filter SJ Park
` (5 preceding siblings ...)
2026-09-10 4:03 ` [RFC PATCH v2.1 6/7] Docs/mm/damon/design: update for probe_hits_wsum DAMOS " SJ Park
@ 2026-09-10 4:03 ` SJ Park
2026-09-10 4:05 ` sashiko-bot
6 siblings, 1 reply; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:03 UTC (permalink / raw)
Cc: SJ Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Randy Dunlap, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-mm
Update DAMON usage document for the newly added probe hits weighted sum
based DAMOS core filter type.
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/admin-guide/mm/damon/usage.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index 023c6334024f8..d3e37400367bd 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -551,6 +551,10 @@ and ``damon_target_idx``. To ``type`` file, you can write the type of the
filter. Refer to :ref:`the design doc <damon_design_damos_filters>` for
available type names, their meaning and on what layer those are handled.
+For ``probe_hits_wsum`` type, you can specify the minimum and maximum probe
+hits weighted sum value for the filter to ``min`` and ``max`` files,
+respectively.
+
For ``memcg`` type, 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. For ``addr`` type, you can specify the start and end
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 7/7] Docs/admin-guide/mm/damon/usage: update for probe_hits_wsum DAMOS filter
2026-09-10 4:03 ` [RFC PATCH v2.1 7/7] Docs/admin-guide/mm/damon/usage: update for probe_hits_wsum DAMOS filter SJ Park
@ 2026-09-10 4:05 ` sashiko-bot
0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-09-10 4:05 UTC (permalink / raw)
To: SJ Park; +Cc: damon
> Update DAMON usage document for the newly added probe hits weighted sum
> based DAMOS core filter type.
>
> Signed-off-by: SJ Park <sj@kernel.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=7
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 6/7] Docs/mm/damon/design: update for probe_hits_wsum DAMOS core filter
2026-09-10 4:03 ` [RFC PATCH v2.1 6/7] Docs/mm/damon/design: update for probe_hits_wsum DAMOS " SJ Park
@ 2026-09-10 4:05 ` sashiko-bot
0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-09-10 4:05 UTC (permalink / raw)
To: SJ Park; +Cc: damon
> Update DAMON design document for the newly added probe hits weighted sum
> based DAMOS core filter type.
>
> Signed-off-by: SJ Park <sj@kernel.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=6
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 2/7] mm/damon/core: extend probe_hits_wsum() for moving sum based calculation
2026-09-10 4:03 ` [RFC PATCH v2.1 2/7] mm/damon/core: extend probe_hits_wsum() for moving sum based calculation SJ Park
@ 2026-09-10 4:08 ` sashiko-bot
0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-09-10 4:08 UTC (permalink / raw)
To: SJ Park; +Cc: damon
> damon_probe_hits_wsum() is being called only in aggregation time. In
> future, it could also be used by DAMOS. In this case, since DAMOS uses
> its own apply_interval, it could be called in sampling time. Then using
> the not yet fully aggregated probe_hits could result in suboptimum
> outcomes. Extend damon_probe_hits_wsum() to get the weighted sum based
> on moving sum to prepare the DAMOS usage.
>
> Signed-off-by: SJ Park <sj@kernel.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=2
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 1/7] mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM
2026-09-10 4:03 ` [RFC PATCH v2.1 1/7] mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM SJ Park
@ 2026-09-10 4:13 ` sashiko-bot
2026-09-10 4:17 ` SJ Park
0 siblings, 1 reply; 18+ messages in thread
From: sashiko-bot @ 2026-09-10 4:13 UTC (permalink / raw)
To: SJ Park; +Cc: damon
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The kernel-doc comment for `enum damos_filter_type` inaccurately describes `DAMOS_FILTER_TYPE_PROBE_HITS_WSUM` as an operations-handled filter instead of a core-handled filter.
--
commit 03957fb4685434f4e403efc7bb804cb84f796dbd
Author: SJ Park <sj@kernel.org>
mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM
This commit updates the DAMON kernel API by introducing the new DAMOS core
filter type, PROBE_HITS_WSUM. It allows API callers to filter target regions
based on their probe hits weighted sum by adding range fields to the
damos_filter structure.
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index 871d26adf6ae5..1deda16bb70b5 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -399,6 +399,7 @@ struct damos_stat {
> * @DAMOS_FILTER_TYPE_UNMAPPED: Unmapped pages.
> * @DAMOS_FILTER_TYPE_ADDR: Address range.
> * @DAMOS_FILTER_TYPE_TARGET: Data Access Monitoring target.
> + * @DAMOS_FILTER_TYPE_PROBE_HITS_WSUM: probe_hits weighted sum range.
> * @NR_DAMOS_FILTER_TYPES: Number of filter types.
> *
> * All types except &DAMOS_FILTER_TYPE_ADDR and &DAMOS_FILTER_TYPE_TARGET
> * are handled by the underlying &struct damon_operations as a part of scheme
> * action trying
[Severity: Low]
Should &DAMOS_FILTER_TYPE_PROBE_HITS_WSUM be added to this exception list?
Since PROBE_HITS_WSUM is implemented as a core-handled filter rather than an
operations-handled filter, this kernel-doc comment for enum damos_filter_type
might need an update. Otherwise, the documentation inaccurately describes it
as handled by operations, creating a mismatch with the actual core logic
implementation.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=1
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 4/7] mm/damon/sysfs-schemes: rename sysfs_filter->sz_range to range_{min,max}
2026-09-10 4:03 ` [RFC PATCH v2.1 4/7] mm/damon/sysfs-schemes: rename sysfs_filter->sz_range to range_{min,max} SJ Park
@ 2026-09-10 4:14 ` sashiko-bot
0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-09-10 4:14 UTC (permalink / raw)
To: SJ Park; +Cc: damon
> DAMON sysfs interface provides 'min' and 'max' files under the DAMOS
> filter directory. The purpose is setting the general range arguments
> for hugepage_size like filters that require range arguments. So far,
> hugepage_size was the only filter using it. Hence sz_range field of
> damon_sysfs_scheme_filter struct was connected to the files.
>
> In future, we could add a new filter that can reuse the 'min' and 'max'
> files. And the filter might use a range of a type that is not size. For
> example, probe_hits weighted sum. In this case, simply reusing the
> sz_range field would make it a little confusing. Rename sz_range to
> range_{min,max} to avoid such confusion.
>
> Signed-off-by: SJ Park <sj@kernel.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=4
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 3/7] mm/damon/core: support probe_hits_wsum damos core filter
2026-09-10 4:03 ` [RFC PATCH v2.1 3/7] mm/damon/core: support probe_hits_wsum damos core filter SJ Park
@ 2026-09-10 4:16 ` sashiko-bot
2026-09-10 4:20 ` SJ Park
0 siblings, 1 reply; 18+ messages in thread
From: sashiko-bot @ 2026-09-10 4:16 UTC (permalink / raw)
To: SJ Park; +Cc: damon
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Missing kunit test coverage for the newly added DAMOS_FILTER_TYPE_PROBE_HITS_WSUM filter.
- [Low] The kerneldoc for `enum damos_filter_type` was not updated to reflect that `DAMOS_FILTER_TYPE_PROBE_HITS_WSUM` is a core layer filter.
--
commit 3af974fc20158a639272fd766ad727c8d30c0f3e
Author: SJ Park <sj@kernel.org>
mm/damon/core: support probe_hits_wsum damos core filter
Implement probe_hits_wsum DAMOS core filter support in the core layer.
Make three small changes for the support: update damos_filter_for_ops() to
treat probe_hits_wsum filter as core filter, update destination
damos_filter->range_{min,max} for probe_hits_wsum, and extend
damos_filter_match() to handle the new filter type.
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index e9630f41e51fe..d9d56f4be1a97 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -658,6 +658,7 @@ bool damos_filter_for_ops(enum damos_filter_type type)
> switch (type) {
> case DAMOS_FILTER_TYPE_ADDR:
> case DAMOS_FILTER_TYPE_TARGET:
> + case DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
[Severity: Low]
Does the kerneldoc for enum damos_filter_type need to be updated to reflect
that DAMOS_FILTER_TYPE_PROBE_HITS_WSUM is a core layer filter?
include/linux/damon.h:enum damos_filter_type {
* All types except &DAMOS_FILTER_TYPE_ADDR and &DAMOS_FILTER_TYPE_TARGET
* are handled by the underlying &struct damon_operations as a part of scheme
* action trying, and therefore accounted as 'tried'.
The documentation here explicitly lists only ADDR and TARGET as exceptions,
failing to update the list with the newly added PROBE_HITS_WSUM core filter.
> return false;
> default:
> break;
[ ... ]
> @@ -1332,6 +1333,10 @@ static void damos_commit_filter_arg(
> case DAMOS_FILTER_TYPE_HUGEPAGE_SIZE:
> dst->sz_range = src->sz_range;
> break;
> + case DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
> + dst->range_min = src->range_min;
> + dst->range_max = src->range_max;
> + break;
[Severity: Low]
Is there missing KUnit test coverage for the newly added
DAMOS_FILTER_TYPE_PROBE_HITS_WSUM filter?
The copying logic for the new filter type's arguments (range_min, range_max)
is left untested, which could hide future regressions.
In mm/damon/tests/core-kunit.h:damos_test_commit_filter_for(), the switch
statement verifies filter argument copying but is missing the case for
DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
case DAMOS_FILTER_TYPE_HUGEPAGE_SIZE:
KUNIT_EXPECT_EQ(test, dst->sz_range.min, src->sz_range.min);
KUNIT_EXPECT_EQ(test, dst->sz_range.max, src->sz_range.max);
break;
default:
break;
}
Additionally, in mm/damon/tests/core-kunit.h:damos_test_commit_filter(),
the function enumerates all filter types for testing but fails to include
instances of DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
damos_test_commit_filter_for(test, &dst,
&(struct damos_filter){
.type = DAMOS_FILTER_TYPE_TARGET,
.matching = true,
.allow = true,
.target_idx = 6,
});
> default:
> break;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=3
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 1/7] mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM
2026-09-10 4:13 ` sashiko-bot
@ 2026-09-10 4:17 ` SJ Park
0 siblings, 0 replies; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:17 UTC (permalink / raw)
To: sashiko-bot; +Cc: SJ Park, damon
On Thu, 10 Sep 2026 04:13:58 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] The kernel-doc comment for `enum damos_filter_type` inaccurately describes `DAMOS_FILTER_TYPE_PROBE_HITS_WSUM` as an operations-handled filter instead of a core-handled filter.
> --
>
> commit 03957fb4685434f4e403efc7bb804cb84f796dbd
> Author: SJ Park <sj@kernel.org>
>
> mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM
>
> This commit updates the DAMON kernel API by introducing the new DAMOS core
> filter type, PROBE_HITS_WSUM. It allows API callers to filter target regions
> based on their probe hits weighted sum by adding range fields to the
> damos_filter structure.
>
> > diff --git a/include/linux/damon.h b/include/linux/damon.h
> > index 871d26adf6ae5..1deda16bb70b5 100644
> > --- a/include/linux/damon.h
> > +++ b/include/linux/damon.h
> > @@ -399,6 +399,7 @@ struct damos_stat {
> > * @DAMOS_FILTER_TYPE_UNMAPPED: Unmapped pages.
> > * @DAMOS_FILTER_TYPE_ADDR: Address range.
> > * @DAMOS_FILTER_TYPE_TARGET: Data Access Monitoring target.
> > + * @DAMOS_FILTER_TYPE_PROBE_HITS_WSUM: probe_hits weighted sum range.
> > * @NR_DAMOS_FILTER_TYPES: Number of filter types.
> > *
> > * All types except &DAMOS_FILTER_TYPE_ADDR and &DAMOS_FILTER_TYPE_TARGET
> > * are handled by the underlying &struct damon_operations as a part of scheme
> > * action trying
>
> [Severity: Low]
> Should &DAMOS_FILTER_TYPE_PROBE_HITS_WSUM be added to this exception list?
>
> Since PROBE_HITS_WSUM is implemented as a core-handled filter rather than an
> operations-handled filter, this kernel-doc comment for enum damos_filter_type
> might need an update. Otherwise, the documentation inaccurately describes it
> as handled by operations, creating a mismatch with the actual core logic
> implementation.
Good point, I will update the comment as recommended.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=1
Thanks,
SJ
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 5/7] mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter
2026-09-10 4:03 ` [RFC PATCH v2.1 5/7] mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter SJ Park
@ 2026-09-10 4:18 ` sashiko-bot
2026-09-10 4:23 ` SJ Park
0 siblings, 1 reply; 18+ messages in thread
From: sashiko-bot @ 2026-09-10 4:18 UTC (permalink / raw)
To: SJ Park; +Cc: damon
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The commit introduces `DAMOS_FILTER_TYPE_PROBE_HITS_WSUM` to the core layer and updates `damos_commit_filter_arg()` to properly copy its state (`range_min` and `range_max`), but fails to update the corresponding KUnit tests that rigorously check this exact behavior.
--
commit 90fc8bb11dba04367743217a5b35954829f87d9c
Author: SJ Park <sj@kernel.org>
mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter
This commit extends the DAMON sysfs interface to support the probe_hits_wsum
input for scheme core filters. It updates the scheme build logic to set up
the min/max probe hits weighted sum range as provided by the user.
> diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
> index 4d9147d2a269e..d9dd4ee0442c7 100644
> --- a/mm/damon/sysfs-schemes.c
> +++ b/mm/damon/sysfs-schemes.c
[ ... ]
> @@ -2844,6 +2847,14 @@ static int damon_sysfs_add_scheme_filters(struct damos *scheme,
> }
> filter->sz_range.min = sysfs_filter->range_min;
> filter->sz_range.max = sysfs_filter->range_max;
> + } else if (filter->type == DAMOS_FILTER_TYPE_PROBE_HITS_WSUM) {
> + if (sysfs_filter->range_min >
> + sysfs_filter->range_max) {
> + damos_destroy_filter(filter);
> + return -EINVAL;
> + }
> + filter->range_min = sysfs_filter->range_min;
> + filter->range_max = sysfs_filter->range_max;
[Severity: Low]
Does the addition of this new filter type require an update to the core
KUnit tests?
In mm/damon/tests/core-kunit.h, there is a switch statement in
damos_test_commit_filter_for() that checks parameter validation for each
filter type:
switch (src->type) {
case DAMOS_FILTER_TYPE_MEMCG:
...
case DAMOS_FILTER_TYPE_HUGEPAGE_SIZE:
KUNIT_EXPECT_EQ(test, dst->sz_range.min, src->sz_range.min);
KUNIT_EXPECT_EQ(test, dst->sz_range.max, src->sz_range.max);
break;
default:
break;
}
Because DAMOS_FILTER_TYPE_PROBE_HITS_WSUM isn't handled here, it falls
through to the default case, bypassing validation.
Additionally, the orchestrating function damos_test_commit_filter() doesn't
appear to have a test block for this new type. Should these KUnit tests be
updated to maintain test coverage for the new feature?
> }
>
> damos_add_filter(scheme, filter);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=5
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 3/7] mm/damon/core: support probe_hits_wsum damos core filter
2026-09-10 4:16 ` sashiko-bot
@ 2026-09-10 4:20 ` SJ Park
0 siblings, 0 replies; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:20 UTC (permalink / raw)
To: sashiko-bot; +Cc: SJ Park, damon
On Thu, 10 Sep 2026 04:16:47 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Low] Missing kunit test coverage for the newly added DAMOS_FILTER_TYPE_PROBE_HITS_WSUM filter.
> - [Low] The kerneldoc for `enum damos_filter_type` was not updated to reflect that `DAMOS_FILTER_TYPE_PROBE_HITS_WSUM` is a core layer filter.
> --
>
> commit 3af974fc20158a639272fd766ad727c8d30c0f3e
> Author: SJ Park <sj@kernel.org>
>
> mm/damon/core: support probe_hits_wsum damos core filter
>
> Implement probe_hits_wsum DAMOS core filter support in the core layer.
> Make three small changes for the support: update damos_filter_for_ops() to
> treat probe_hits_wsum filter as core filter, update destination
> damos_filter->range_{min,max} for probe_hits_wsum, and extend
> damos_filter_match() to handle the new filter type.
>
> > diff --git a/mm/damon/core.c b/mm/damon/core.c
> > index e9630f41e51fe..d9d56f4be1a97 100644
> > --- a/mm/damon/core.c
> > +++ b/mm/damon/core.c
> > @@ -658,6 +658,7 @@ bool damos_filter_for_ops(enum damos_filter_type type)
> > switch (type) {
> > case DAMOS_FILTER_TYPE_ADDR:
> > case DAMOS_FILTER_TYPE_TARGET:
> > + case DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
>
> [Severity: Low]
> Does the kerneldoc for enum damos_filter_type need to be updated to reflect
> that DAMOS_FILTER_TYPE_PROBE_HITS_WSUM is a core layer filter?
>
> include/linux/damon.h:enum damos_filter_type {
> * All types except &DAMOS_FILTER_TYPE_ADDR and &DAMOS_FILTER_TYPE_TARGET
> * are handled by the underlying &struct damon_operations as a part of scheme
> * action trying, and therefore accounted as 'tried'.
>
> The documentation here explicitly lists only ADDR and TARGET as exceptions,
> failing to update the list with the newly added PROBE_HITS_WSUM core filter.
Yes, I will update so in the next revision.
>
> > return false;
> > default:
> > break;
>
> [ ... ]
>
> > @@ -1332,6 +1333,10 @@ static void damos_commit_filter_arg(
> > case DAMOS_FILTER_TYPE_HUGEPAGE_SIZE:
> > dst->sz_range = src->sz_range;
> > break;
> > + case DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
> > + dst->range_min = src->range_min;
> > + dst->range_max = src->range_max;
> > + break;
>
> [Severity: Low]
> Is there missing KUnit test coverage for the newly added
> DAMOS_FILTER_TYPE_PROBE_HITS_WSUM filter?
>
> The copying logic for the new filter type's arguments (range_min, range_max)
> is left untested, which could hide future regressions.
>
> In mm/damon/tests/core-kunit.h:damos_test_commit_filter_for(), the switch
> statement verifies filter argument copying but is missing the case for
> DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
>
> case DAMOS_FILTER_TYPE_HUGEPAGE_SIZE:
> KUNIT_EXPECT_EQ(test, dst->sz_range.min, src->sz_range.min);
> KUNIT_EXPECT_EQ(test, dst->sz_range.max, src->sz_range.max);
> break;
> default:
> break;
> }
>
> Additionally, in mm/damon/tests/core-kunit.h:damos_test_commit_filter(),
> the function enumerates all filter types for testing but fails to include
> instances of DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
>
> damos_test_commit_filter_for(test, &dst,
> &(struct damos_filter){
> .type = DAMOS_FILTER_TYPE_TARGET,
> .matching = true,
> .allow = true,
> .target_idx = 6,
> });
Good callout. But definitely not a blocker of this series. I will consider
adding such tests as a followup.
>
> > default:
> > break;
> > }
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=3
>
Thanks,
SJ
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC PATCH v2.1 5/7] mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter
2026-09-10 4:18 ` sashiko-bot
@ 2026-09-10 4:23 ` SJ Park
0 siblings, 0 replies; 18+ messages in thread
From: SJ Park @ 2026-09-10 4:23 UTC (permalink / raw)
To: sashiko-bot; +Cc: SJ Park, damon
On Thu, 10 Sep 2026 04:18:33 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] The commit introduces `DAMOS_FILTER_TYPE_PROBE_HITS_WSUM` to the core layer and updates `damos_commit_filter_arg()` to properly copy its state (`range_min` and `range_max`), but fails to update the corresponding KUnit tests that rigorously check this exact behavior.
> --
>
> commit 90fc8bb11dba04367743217a5b35954829f87d9c
> Author: SJ Park <sj@kernel.org>
>
> mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter
>
> This commit extends the DAMON sysfs interface to support the probe_hits_wsum
> input for scheme core filters. It updates the scheme build logic to set up
> the min/max probe hits weighted sum range as provided by the user.
>
> > diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
> > index 4d9147d2a269e..d9dd4ee0442c7 100644
> > --- a/mm/damon/sysfs-schemes.c
> > +++ b/mm/damon/sysfs-schemes.c
>
> [ ... ]
>
> > @@ -2844,6 +2847,14 @@ static int damon_sysfs_add_scheme_filters(struct damos *scheme,
> > }
> > filter->sz_range.min = sysfs_filter->range_min;
> > filter->sz_range.max = sysfs_filter->range_max;
> > + } else if (filter->type = DAMOS_FILTER_TYPE_PROBE_HITS_WSUM) {
> > + if (sysfs_filter->range_min >
> > + sysfs_filter->range_max) {
> > + damos_destroy_filter(filter);
> > + return -EINVAL;
> > + }
> > + filter->range_min = sysfs_filter->range_min;
> > + filter->range_max = sysfs_filter->range_max;
>
> [Severity: Low]
> Does the addition of this new filter type require an update to the core
> KUnit tests?
>
> In mm/damon/tests/core-kunit.h, there is a switch statement in
> damos_test_commit_filter_for() that checks parameter validation for each
> filter type:
>
> switch (src->type) {
> case DAMOS_FILTER_TYPE_MEMCG:
> ...
> case DAMOS_FILTER_TYPE_HUGEPAGE_SIZE:
> KUNIT_EXPECT_EQ(test, dst->sz_range.min, src->sz_range.min);
> KUNIT_EXPECT_EQ(test, dst->sz_range.max, src->sz_range.max);
> break;
> default:
> break;
> }
>
> Because DAMOS_FILTER_TYPE_PROBE_HITS_WSUM isn't handled here, it falls
> through to the default case, bypassing validation.
>
> Additionally, the orchestrating function damos_test_commit_filter() doesn't
> appear to have a test block for this new type. Should these KUnit tests be
> updated to maintain test coverage for the new feature?
It would be good to add a test, but not necessarily together with this series.
I will consider adding such tests as a followup in future.
>
> > }
> >
> > damos_add_filter(scheme, filter);
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260910040319.147037-1-sj@kernel.org?part=5
>
Thanks,
SJ
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2026-09-10 4:23 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10 4:03 [RFC PATCH v2.1 0/7] mm/damon: introduce probe_hits_wsum DAMOS core filter SJ Park
2026-09-10 4:03 ` [RFC PATCH v2.1 1/7] mm/damon/api: introduce DAMOS_FILTER_TYPE_PROBE_HITS_WSUM SJ Park
2026-09-10 4:13 ` sashiko-bot
2026-09-10 4:17 ` SJ Park
2026-09-10 4:03 ` [RFC PATCH v2.1 2/7] mm/damon/core: extend probe_hits_wsum() for moving sum based calculation SJ Park
2026-09-10 4:08 ` sashiko-bot
2026-09-10 4:03 ` [RFC PATCH v2.1 3/7] mm/damon/core: support probe_hits_wsum damos core filter SJ Park
2026-09-10 4:16 ` sashiko-bot
2026-09-10 4:20 ` SJ Park
2026-09-10 4:03 ` [RFC PATCH v2.1 4/7] mm/damon/sysfs-schemes: rename sysfs_filter->sz_range to range_{min,max} SJ Park
2026-09-10 4:14 ` sashiko-bot
2026-09-10 4:03 ` [RFC PATCH v2.1 5/7] mm/damon/sysfs-schemes: support probe_hits_wsum damos core filter SJ Park
2026-09-10 4:18 ` sashiko-bot
2026-09-10 4:23 ` SJ Park
2026-09-10 4:03 ` [RFC PATCH v2.1 6/7] Docs/mm/damon/design: update for probe_hits_wsum DAMOS " SJ Park
2026-09-10 4:05 ` sashiko-bot
2026-09-10 4:03 ` [RFC PATCH v2.1 7/7] Docs/admin-guide/mm/damon/usage: update for probe_hits_wsum DAMOS filter SJ Park
2026-09-10 4:05 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox