* [PATCH 01/16] mm/damon: clarify trying vs applying on damos_stat kernel-doc comment
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 02/16] Docs/mm/damon/design: add 'statistics' section SeongJae Park
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
DAMOS stat kernel-doc documentation is using terms that bit ambiguous.
Without reading the code, understanding it correctly is not that easy.
Add the clarification on the kernel-doc comment.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 2889de3526c3..b85eae388f5b 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -287,6 +287,23 @@ struct damos_watermarks {
* @nr_applied: Total number of regions that the scheme is applied.
* @sz_applied: Total size of regions that the scheme is applied.
* @qt_exceeds: Total number of times the quota of the scheme has exceeded.
+ *
+ * "Tried an action to a region" in this context means the DAMOS core logic
+ * determined the region as eligible to apply the action. The access pattern
+ * (&struct damos_access_pattern), quotas (&struct damos_quota), watermarks
+ * (&struct damos_watermarks) and filters (&struct damos_filter) that handled
+ * on core logic can affect this. The core logic asks the operation set
+ * (&struct damon_operations) to apply the action to the region.
+ *
+ * "Applied an action to a region" in this context means the operation set
+ * (&struct damon_operations) successfully applied the action to the region, at
+ * least to a part of the region. The filters (&struct damos_filter) that
+ * handled on operation set layer and type of the action and pages of the
+ * region can affect this. For example, if a filter is set to exclude
+ * anonymous pages and the region has only anonymous pages, the region will be
+ * failed at applying the action. If the action is &DAMOS_PAGEOUT and all
+ * pages of the region are already paged out, the region will be failed at
+ * applying the action.
*/
struct damos_stat {
unsigned long nr_tried;
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 02/16] Docs/mm/damon/design: add 'statistics' section
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
2025-01-06 19:33 ` [PATCH 01/16] mm/damon: clarify trying vs applying on damos_stat kernel-doc comment SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 03/16] Docs/admin-guide/mm/damon/usage: link damos stat design doc SeongJae Park
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, linux-doc, linux-kernel, linux-mm
DAMOS stats are important feature for tuning of DAMOS-based access-aware
system operation, and efficient access pattern monitoring. But not well
documented on the design document. Add a section on the document.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/mm/damon/design.rst | 38 +++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index 5385ea04c2fd..aa2e4694ee14 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -539,6 +539,44 @@ To know how user-space can set the watermarks via :ref:`DAMON sysfs interface
<sysfs_interface>`, refer to :ref:`filters <sysfs_filters>` part of the
documentation.
+Statistics
+~~~~~~~~~~
+
+The statistics of DAMOS behaviors that designed to help monitoring, tuning and
+debugging of DAMOS.
+
+DAMOS accounts below statistics for each scheme, from the beginning of the
+scheme's execution.
+
+- ``nr_tried``: Total number of regions that the scheme is tried to be applied.
+- ``sz_trtied``: Total size of regions that the scheme is tried to be applied.
+- ``nr_applied``: Total number of regions that the scheme is applied.
+- ``sz_applied``: Total size of regions that the scheme is applied.
+- ``qt_exceeds``: Total number of times the quota of the scheme has exceeded.
+
+"A scheme is tried to be applied to a region" means DAMOS core logic determined
+the region is eligible to apply the scheme's :ref:`action
+<damon_design_damos_action>`. The :ref:`access pattern
+<damon_design_damos_access_pattern>`, :ref:`quotas
+<damon_design_damos_quotas>`, :ref:`watermarks
+<damon_design_damos_watermarks>`, and :ref:`filters
+<damon_design_damos_filters>` that handled on core logic could affect this.
+The core logic will only ask the underlying :ref:`operation set
+<damon_operations_set>` to do apply the action to the region, so whether the
+action is really applied or not is unclear. That's why it is called "tried".
+
+"A scheme is applied to a region" means the :ref:`operation set
+<damon_operations_set>` has applied the action to at least a part of the
+region. The :ref:`filters <damon_design_damos_filters>` that handled by the
+operation set, and the types of the :ref:`action <damon_design_damos_action>`
+and the pages of the region can affect this. For example, if a filter is set
+to exclude anonymous pages and the region has only anonymous pages, or if the
+action is ``pageout`` while all pages of the region are unreclaimable, applying
+the action to the region will fail.
+
+To know how user-space can read the stats via :ref:`DAMON sysfs interface
+<sysfs_interface>`, refer to :ref:s`stats <sysfs_stats>` part of the
+documentation.
Regions Walking
~~~~~~~~~~~~~~~
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 03/16] Docs/admin-guide/mm/damon/usage: link damos stat design doc
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
2025-01-06 19:33 ` [PATCH 01/16] mm/damon: clarify trying vs applying on damos_stat kernel-doc comment SeongJae Park
2025-01-06 19:33 ` [PATCH 02/16] Docs/mm/damon/design: add 'statistics' section SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 04/16] mm/damon: ask apply_scheme() to report filter-passed region-internal bytes SeongJae Park
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, linux-doc, linux-kernel, linux-mm
DAMON sysfs usage document focuses on usage, rather than the detail of
the stat metric itself. Add a link to the design document on DAMOS stat
usage section.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/admin-guide/mm/damon/usage.rst | 3 ++-
Documentation/mm/damon/design.rst | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index c685d87ea078..2e835c9bcfdf 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -451,7 +451,8 @@ schemes/<N>/stats/
DAMON counts the total number and bytes of regions that each scheme is tried to
be applied, the two numbers for the regions that each scheme is successfully
applied, and the total number of the quota limit exceeds. This statistics can
-be used for online analysis or tuning of the schemes.
+be used for online analysis or tuning of the schemes. Refer to :ref:`design
+doc <damon_design_damos_stat>` for more details about the stats.
The statistics can be retrieved by reading the files under ``stats`` directory
(``nr_tried``, ``sz_tried``, ``nr_applied``, ``sz_applied``, and
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index aa2e4694ee14..158d0a4e1d7f 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -539,6 +539,8 @@ To know how user-space can set the watermarks via :ref:`DAMON sysfs interface
<sysfs_interface>`, refer to :ref:`filters <sysfs_filters>` part of the
documentation.
+.. _damon_design_damos_stat:
+
Statistics
~~~~~~~~~~
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 04/16] mm/damon: ask apply_scheme() to report filter-passed region-internal bytes
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (2 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 03/16] Docs/admin-guide/mm/damon/usage: link damos stat design doc SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 05/16] mm/damon/paddr: report filter-passed bytes back for normal actions SeongJae Park
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
Some DAMOS filter types including those for young page, anon page, and
belonging memcg are handled by underlying DAMON operations set
implementation, via damon_operations->apply_scheme() interface. How
many bytes of the region have passed the filter can be useful for DAMOS
scheme tuning and access pattern monitoring. Modify the interface to
let the callback implementation reports back the number if possible.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 5 +++--
mm/damon/core.c | 4 +++-
mm/damon/paddr.c | 2 +-
mm/damon/vaddr.c | 2 +-
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index b85eae388f5b..da003173210f 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -529,7 +529,8 @@ enum damon_ops_id {
* @apply_scheme is called from @kdamond when a region for user provided
* DAMON-based operation scheme is found. It should apply the scheme's action
* to the region and return bytes of the region that the action is successfully
- * applied.
+ * applied. It should also report how many bytes of the region has passed
+ * filters (&struct damos_filter) that handled by itself.
* @target_valid should check whether the target is still valid for the
* monitoring.
* @cleanup is called from @kdamond just before its termination.
@@ -546,7 +547,7 @@ struct damon_operations {
struct damos *scheme);
unsigned long (*apply_scheme)(struct damon_ctx *context,
struct damon_target *t, struct damon_region *r,
- struct damos *scheme);
+ struct damos *scheme, unsigned long *sz_filter_passed);
bool (*target_valid)(struct damon_target *t);
void (*cleanup)(struct damon_ctx *context);
};
diff --git a/mm/damon/core.c b/mm/damon/core.c
index d02a7d6da855..c6ccb4825c57 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1523,6 +1523,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
unsigned long sz = damon_sz_region(r);
struct timespec64 begin, end;
unsigned long sz_applied = 0;
+ unsigned long sz_ops_filter_passed = 0;
int err = 0;
/*
* We plan to support multiple context per kdamond, as DAMON sysfs
@@ -1568,7 +1569,8 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
if (!err) {
trace_damos_before_apply(cidx, sidx, tidx, r,
damon_nr_regions(t), do_trace);
- sz_applied = c->ops.apply_scheme(c, t, r, s);
+ sz_applied = c->ops.apply_scheme(c, t, r, s,
+ &sz_ops_filter_passed);
}
damos_walk_call_walk(c, t, r, s);
ktime_get_coarse_ts64(&end);
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index a9ff35341d65..3530ef9c80bd 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -477,7 +477,7 @@ static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s)
static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
struct damon_target *t, struct damon_region *r,
- struct damos *scheme)
+ struct damos *scheme, unsigned long *sz_filter_passed)
{
switch (scheme->action) {
case DAMOS_PAGEOUT:
diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index b9eaa20b73b9..a6174f725bd7 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -655,7 +655,7 @@ static unsigned long damos_madvise(struct damon_target *target,
static unsigned long damon_va_apply_scheme(struct damon_ctx *ctx,
struct damon_target *t, struct damon_region *r,
- struct damos *scheme)
+ struct damos *scheme, unsigned long *sz_filter_passed)
{
int madv_action;
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 05/16] mm/damon/paddr: report filter-passed bytes back for normal actions
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (3 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 04/16] mm/damon: ask apply_scheme() to report filter-passed region-internal bytes SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 06/16] mm/damon/paddr: report filter-passed bytes back for DAMOS_STAT action SeongJae Park
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
damon_operations->apply_scheme() implementations are requested to report
back how many bytes of the given region has passed DAMOS filter.
'paddr' operations set implementation supports some of region-internal
DAMOS filter handling for normal DAMOS actions except DAMOS_STAT action.
But, those are not respecting the request. Report the region-internal
DAMOS filter-passed bytes back for the actions.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/paddr.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 3530ef9c80bd..5944316a0b4c 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -243,7 +243,8 @@ static bool damos_pa_filter_out(struct damos *scheme, struct folio *folio)
return false;
}
-static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
+static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s,
+ unsigned long *sz_filter_passed)
{
unsigned long addr, applied;
LIST_HEAD(folio_list);
@@ -272,6 +273,8 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
if (damos_pa_filter_out(s, folio))
goto put_folio;
+ else
+ *sz_filter_passed += folio_size(folio);
folio_clear_referenced(folio);
folio_test_clear_young(folio);
@@ -292,7 +295,8 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
}
static inline unsigned long damon_pa_mark_accessed_or_deactivate(
- struct damon_region *r, struct damos *s, bool mark_accessed)
+ struct damon_region *r, struct damos *s, bool mark_accessed,
+ unsigned long *sz_filter_passed)
{
unsigned long addr, applied = 0;
@@ -304,6 +308,8 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate(
if (damos_pa_filter_out(s, folio))
goto put_folio;
+ else
+ *sz_filter_passed += folio_size(folio);
if (mark_accessed)
folio_mark_accessed(folio);
@@ -317,15 +323,17 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate(
}
static unsigned long damon_pa_mark_accessed(struct damon_region *r,
- struct damos *s)
+ struct damos *s, unsigned long *sz_filter_passed)
{
- return damon_pa_mark_accessed_or_deactivate(r, s, true);
+ return damon_pa_mark_accessed_or_deactivate(r, s, true,
+ sz_filter_passed);
}
static unsigned long damon_pa_deactivate_pages(struct damon_region *r,
- struct damos *s)
+ struct damos *s, unsigned long *sz_filter_passed)
{
- return damon_pa_mark_accessed_or_deactivate(r, s, false);
+ return damon_pa_mark_accessed_or_deactivate(r, s, false,
+ sz_filter_passed);
}
static unsigned int __damon_pa_migrate_folio_list(
@@ -449,7 +457,8 @@ static unsigned long damon_pa_migrate_pages(struct list_head *folio_list,
return nr_migrated;
}
-static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s)
+static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s,
+ unsigned long *sz_filter_passed)
{
unsigned long addr, applied;
LIST_HEAD(folio_list);
@@ -462,6 +471,8 @@ static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s)
if (damos_pa_filter_out(s, folio))
goto put_folio;
+ else
+ *sz_filter_passed += folio_size(folio);
if (!folio_isolate_lru(folio))
goto put_folio;
@@ -481,14 +492,14 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
{
switch (scheme->action) {
case DAMOS_PAGEOUT:
- return damon_pa_pageout(r, scheme);
+ return damon_pa_pageout(r, scheme, sz_filter_passed);
case DAMOS_LRU_PRIO:
- return damon_pa_mark_accessed(r, scheme);
+ return damon_pa_mark_accessed(r, scheme, sz_filter_passed);
case DAMOS_LRU_DEPRIO:
- return damon_pa_deactivate_pages(r, scheme);
+ return damon_pa_deactivate_pages(r, scheme, sz_filter_passed);
case DAMOS_MIGRATE_HOT:
case DAMOS_MIGRATE_COLD:
- return damon_pa_migrate(r, scheme);
+ return damon_pa_migrate(r, scheme, sz_filter_passed);
case DAMOS_STAT:
break;
default:
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 06/16] mm/damon/paddr: report filter-passed bytes back for DAMOS_STAT action
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (4 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 05/16] mm/damon/paddr: report filter-passed bytes back for normal actions SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 07/16] mm/damon/core: implement per-scheme ops-handled filter-passed bytes stat SeongJae Park
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
DAMOS_STAT action handling of paddr DAMON operations set implementation
is simply ignoring the region-internal DAMOS filters, and therefore not
reporting back the filter-passed bytes. Apply the filters and report
back the information.
Before this change, DAMOS_STAT was doing nothing for DAMOS filters.
Hence users might see some performance regressions. Such regression for
use cases where no region-internal DAMOS filter is added to the scheme
will be negligible, since this change avoids unnecessary filtering works
if no such filter is installed.
For old users who are using DAMOS_STAT with the types of filters, the
regression could be visible depending on the size of the region and the
overhead of the installed DAMOS filters. But, because the filters were
completely ignored before in the use case, no real users would really
depend on such use case that makes no point.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/paddr.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 5944316a0b4c..b0c283808ba6 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -485,6 +485,39 @@ static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s,
return applied * PAGE_SIZE;
}
+static bool damon_pa_scheme_has_filter(struct damos *s)
+{
+ struct damos_filter *f;
+
+ damos_for_each_filter(f, s)
+ return true;
+ return false;
+}
+
+static unsigned long damon_pa_stat(struct damon_region *r, struct damos *s,
+ unsigned long *sz_filter_passed)
+{
+ unsigned long addr;
+ LIST_HEAD(folio_list);
+
+ if (!damon_pa_scheme_has_filter(s))
+ return 0;
+
+ for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) {
+ struct folio *folio = damon_get_folio(PHYS_PFN(addr));
+
+ if (!folio)
+ continue;
+
+ if (damos_pa_filter_out(s, folio))
+ goto put_folio;
+ else
+ *sz_filter_passed += folio_size(folio);
+put_folio:
+ folio_put(folio);
+ }
+ return 0;
+}
static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
struct damon_target *t, struct damon_region *r,
@@ -501,7 +534,7 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx,
case DAMOS_MIGRATE_COLD:
return damon_pa_migrate(r, scheme, sz_filter_passed);
case DAMOS_STAT:
- break;
+ return damon_pa_stat(r, scheme, sz_filter_passed);
default:
/* DAMOS actions that not yet supported by 'paddr'. */
break;
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 07/16] mm/damon/core: implement per-scheme ops-handled filter-passed bytes stat
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (5 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 06/16] mm/damon/paddr: report filter-passed bytes back for DAMOS_STAT action SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 08/16] mm/damon/syfs-schemes: implement per-scheme " SeongJae Park
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
Implement a new per-DAMOS scheme statistic field, namely
sz_ops_filter_passed, using the changed damon_operations->apply_scheme()
interface. It counts total bytes of memory that given DAMOS action
tried to be applied, and passed the operations layer handled
region-internal filters of the scheme. DAMON API users can access it
using DAMON-internal safe access features such as damon_call() and/or
damos_walk().
Signed-off-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 3 +++
mm/damon/core.c | 6 ++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index da003173210f..2a93dbe06ecc 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -286,6 +286,8 @@ struct damos_watermarks {
* @sz_tried: Total size of regions that the scheme is tried to be applied.
* @nr_applied: Total number of regions that the scheme is applied.
* @sz_applied: Total size of regions that the scheme is applied.
+ * @sz_ops_filter_passed:
+ * Total bytes that passed ops layer-handled DAMOS filters.
* @qt_exceeds: Total number of times the quota of the scheme has exceeded.
*
* "Tried an action to a region" in this context means the DAMOS core logic
@@ -310,6 +312,7 @@ struct damos_stat {
unsigned long sz_tried;
unsigned long nr_applied;
unsigned long sz_applied;
+ unsigned long sz_ops_filter_passed;
unsigned long qt_exceeds;
};
diff --git a/mm/damon/core.c b/mm/damon/core.c
index c6ccb4825c57..c4ce72a86d81 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1362,13 +1362,15 @@ static bool damos_skip_charged_region(struct damon_target *t,
}
static void damos_update_stat(struct damos *s,
- unsigned long sz_tried, unsigned long sz_applied)
+ unsigned long sz_tried, unsigned long sz_applied,
+ unsigned long sz_ops_filter_passed)
{
s->stat.nr_tried++;
s->stat.sz_tried += sz_tried;
if (sz_applied)
s->stat.nr_applied++;
s->stat.sz_applied += sz_applied;
+ s->stat.sz_ops_filter_passed += sz_ops_filter_passed;
}
static bool __damos_filter_out(struct damon_ctx *ctx, struct damon_target *t,
@@ -1586,7 +1588,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
r->age = 0;
update_stat:
- damos_update_stat(s, sz, sz_applied);
+ damos_update_stat(s, sz, sz_applied, sz_ops_filter_passed);
}
static void damon_do_apply_schemes(struct damon_ctx *c,
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 08/16] mm/damon/syfs-schemes: implement per-scheme filter-passed bytes stat
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (6 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 07/16] mm/damon/core: implement per-scheme ops-handled filter-passed bytes stat SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 09/16] Docs/mm/damon/design: document sz_ops_filter_passed SeongJae Park
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
Add a new DAMON sysfs interface file under scheme stat directory, namely
'sz_ops_filter_passed'. It represents total bytes that passed
region-internal DAMOS filters of the scheme that handled by the DAMON
operations set layer.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/sysfs-schemes.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index 5c4490b97258..b447c412b02c 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -188,6 +188,7 @@ struct damon_sysfs_stats {
unsigned long sz_tried;
unsigned long nr_applied;
unsigned long sz_applied;
+ unsigned long sz_ops_filter_passed;
unsigned long qt_exceeds;
};
@@ -232,6 +233,15 @@ static ssize_t sz_applied_show(struct kobject *kobj,
return sysfs_emit(buf, "%lu\n", stats->sz_applied);
}
+static ssize_t sz_ops_filter_passed_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ struct damon_sysfs_stats *stats = container_of(kobj,
+ struct damon_sysfs_stats, kobj);
+
+ return sysfs_emit(buf, "%lu\n", stats->sz_ops_filter_passed);
+}
+
static ssize_t qt_exceeds_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
@@ -258,6 +268,9 @@ static struct kobj_attribute damon_sysfs_stats_nr_applied_attr =
static struct kobj_attribute damon_sysfs_stats_sz_applied_attr =
__ATTR_RO_MODE(sz_applied, 0400);
+static struct kobj_attribute damon_sysfs_stats_sz_ops_filter_passed_attr =
+ __ATTR_RO_MODE(sz_ops_filter_passed, 0400);
+
static struct kobj_attribute damon_sysfs_stats_qt_exceeds_attr =
__ATTR_RO_MODE(qt_exceeds, 0400);
@@ -266,6 +279,7 @@ static struct attribute *damon_sysfs_stats_attrs[] = {
&damon_sysfs_stats_sz_tried_attr.attr,
&damon_sysfs_stats_nr_applied_attr.attr,
&damon_sysfs_stats_sz_applied_attr.attr,
+ &damon_sysfs_stats_sz_ops_filter_passed_attr.attr,
&damon_sysfs_stats_qt_exceeds_attr.attr,
NULL,
};
@@ -2077,6 +2091,8 @@ void damon_sysfs_schemes_update_stats(
sysfs_stats->sz_tried = scheme->stat.sz_tried;
sysfs_stats->nr_applied = scheme->stat.nr_applied;
sysfs_stats->sz_applied = scheme->stat.sz_applied;
+ sysfs_stats->sz_ops_filter_passed =
+ scheme->stat.sz_ops_filter_passed;
sysfs_stats->qt_exceeds = scheme->stat.qt_exceeds;
}
}
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 09/16] Docs/mm/damon/design: document sz_ops_filter_passed
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (7 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 08/16] mm/damon/syfs-schemes: implement per-scheme " SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 10/16] Docs/admin-guide/mm/damon/usage: " SeongJae Park
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, linux-doc, linux-kernel, linux-mm
Document the new per-scheme accumulated stat for total bytes that passed
the operations set layer-handled DAMOS filters on the design document.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/mm/damon/design.rst | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index 158d0a4e1d7f..68145972cb20 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -552,6 +552,8 @@ scheme's execution.
- ``nr_tried``: Total number of regions that the scheme is tried to be applied.
- ``sz_trtied``: Total size of regions that the scheme is tried to be applied.
+- ``sz_ops_filter_passed``: Total bytes that passed operations set
+ layer-handled DAMOS filters.
- ``nr_applied``: Total number of regions that the scheme is applied.
- ``sz_applied``: Total size of regions that the scheme is applied.
- ``qt_exceeds``: Total number of times the quota of the scheme has exceeded.
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 10/16] Docs/admin-guide/mm/damon/usage: document sz_ops_filter_passed
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (8 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 09/16] Docs/mm/damon/design: document sz_ops_filter_passed SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 11/16] Docs/ABI/damon: document per-scheme filter-passed bytes stat file SeongJae Park
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, linux-doc, linux-kernel, linux-mm
Document the new per-scheme operations set layer-handled DAMOS filters
passed bytes statistic file on DAMON sysfs interface usage document.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/admin-guide/mm/damon/usage.rst | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index 2e835c9bcfdf..95c174be9c06 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -84,7 +84,7 @@ comma (",").
│ │ │ │ │ │ │ :ref:`watermarks <sysfs_watermarks>`/metric,interval_us,high,mid,low
│ │ │ │ │ │ │ :ref:`filters <sysfs_filters>`/nr_filters
│ │ │ │ │ │ │ │ 0/type,matching,memcg_id
- │ │ │ │ │ │ │ :ref:`stats <sysfs_schemes_stats>`/nr_tried,sz_tried,nr_applied,sz_applied,qt_exceeds
+ │ │ │ │ │ │ │ :ref:`stats <sysfs_schemes_stats>`/nr_tried,sz_tried,nr_applied,sz_applied,sz_ops_filter_passed,qt_exceeds
│ │ │ │ │ │ │ :ref:`tried_regions <sysfs_schemes_tried_regions>`/total_bytes
│ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age
│ │ │ │ │ │ │ │ ...
@@ -448,18 +448,16 @@ difference is applied to :ref:`stats <damos_stats>` and
schemes/<N>/stats/
------------------
-DAMON counts the total number and bytes of regions that each scheme is tried to
-be applied, the two numbers for the regions that each scheme is successfully
-applied, and the total number of the quota limit exceeds. This statistics can
-be used for online analysis or tuning of the schemes. Refer to :ref:`design
-doc <damon_design_damos_stat>` for more details about the stats.
+DAMON counts statistics for each scheme. This statistics can be used for
+online analysis or tuning of the schemes. Refer to :ref:`design doc
+<damon_design_damos_stat>` for more details about the stats.
The statistics can be retrieved by reading the files under ``stats`` directory
-(``nr_tried``, ``sz_tried``, ``nr_applied``, ``sz_applied``, and
-``qt_exceeds``), respectively. The files are not updated in real time, so you
-should ask DAMON sysfs interface to update the content of the files for the
-stats by writing a special keyword, ``update_schemes_stats`` to the relevant
-``kdamonds/<N>/state`` file.
+(``nr_tried``, ``sz_tried``, ``nr_applied``, ``sz_applied``,
+``sz_ops_filter_passed``, and ``qt_exceeds``), respectively. The files are not
+updated in real time, so you should ask DAMON sysfs interface to update the
+content of the files for the stats by writing a special keyword,
+``update_schemes_stats`` to the relevant ``kdamonds/<N>/state`` file.
.. _sysfs_schemes_tried_regions:
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 11/16] Docs/ABI/damon: document per-scheme filter-passed bytes stat file
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (9 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 10/16] Docs/admin-guide/mm/damon/usage: " SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 12/16] mm/damon/core: pass per-region filter-passed bytes to damos_walk_control->walk_fn() SeongJae Park
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
Document the new ABI for per-scheme operations set layer-handled DAMOS
filters passed bytes statistic on the ABI document.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/ABI/testing/sysfs-kernel-mm-damon | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon
index f1b90cf1249b..19cde386fd15 100644
--- a/Documentation/ABI/testing/sysfs-kernel-mm-damon
+++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon
@@ -384,6 +384,12 @@ Contact: SeongJae Park <sj@kernel.org>
Description: Reading this file returns the total size of regions that the
action of the scheme has successfully applied in bytes.
+What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/sz_ops_filter_passed
+Date: Dec 2024
+Contact: SeongJae Park <sj@kernel.org>
+Description: Reading this file returns the total size of memory that passed
+ DAMON operations layer-handled filters of the scheme in bytes.
+
What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/qt_exceeds
Date: Mar 2022
Contact: SeongJae Park <sj@kernel.org>
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 12/16] mm/damon/core: pass per-region filter-passed bytes to damos_walk_control->walk_fn()
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (10 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 11/16] Docs/ABI/damon: document per-scheme filter-passed bytes stat file SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 13/16] mm/damon/sysfs-schemes: expose per-region filter-passed bytes SeongJae Park
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
Total size of memory that passed DAMON operations set layer-handled
DAMOS filters per scheme is provided to DAMON core API and ABI (sysfs
interface) users. Having it per-region in non-accumulated way can
provide it in finer granularity. Provide it to damos_walk() core API
users, by passing the data to damos_walk_control->walk_fn().
Signed-off-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 2 +-
mm/damon/core.c | 7 ++++---
mm/damon/sysfs.c | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 2a93dbe06ecc..298b1a831e62 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -388,7 +388,7 @@ struct damos;
struct damos_walk_control {
void (*walk_fn)(void *data, struct damon_ctx *ctx,
struct damon_target *t, struct damon_region *r,
- struct damos *s);
+ struct damos *s, unsigned long sz_filter_passed);
void *data;
/* private: internal use only */
/* informs if the kdamond finished handling of the walk request */
diff --git a/mm/damon/core.c b/mm/damon/core.c
index c4ce72a86d81..52e50f183ffe 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1445,7 +1445,8 @@ static bool damos_filter_out(struct damon_ctx *ctx, struct damon_target *t,
* installed by damos_walk() and not yet uninstalled, invoke it.
*/
static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t,
- struct damon_region *r, struct damos *s)
+ struct damon_region *r, struct damos *s,
+ unsigned long sz_filter_passed)
{
struct damos_walk_control *control;
@@ -1454,7 +1455,7 @@ static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t,
mutex_unlock(&ctx->walk_control_lock);
if (!control)
return;
- control->walk_fn(control->data, ctx, t, r, s);
+ control->walk_fn(control->data, ctx, t, r, s, sz_filter_passed);
}
/*
@@ -1574,7 +1575,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t,
sz_applied = c->ops.apply_scheme(c, t, r, s,
&sz_ops_filter_passed);
}
- damos_walk_call_walk(c, t, r, s);
+ damos_walk_call_walk(c, t, r, s, sz_ops_filter_passed);
ktime_get_coarse_ts64(&end);
quota->total_charged_ns += timespec64_to_ns(&end) -
timespec64_to_ns(&begin);
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index cf8fb5a963d6..224873ca8aa6 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1454,7 +1454,7 @@ struct damon_sysfs_schemes_walk_data {
/* populate the region directory */
static void damon_sysfs_schemes_tried_regions_upd_one(void *data, struct damon_ctx *ctx,
struct damon_target *t, struct damon_region *r,
- struct damos *s)
+ struct damos *s, unsigned long sz_filter_passed)
{
struct damon_sysfs_schemes_walk_data *walk_data = data;
struct damon_sysfs_kdamond *sysfs_kdamond = walk_data->sysfs_kdamond;
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 13/16] mm/damon/sysfs-schemes: expose per-region filter-passed bytes
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (11 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 12/16] mm/damon/core: pass per-region filter-passed bytes to damos_walk_control->walk_fn() SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:33 ` [PATCH 14/16] Docs/mm/damon/design: document per-region sz_filter_passed stat SeongJae Park
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
Per-region operations set-handled DAMOS filters passed memory size
information is provided to only DAMON core API users. Further expose it
to the user space by adding a new DAMON sysfs interface file under each
scheme tried region directory.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/sysfs-common.h | 2 +-
mm/damon/sysfs-schemes.c | 19 ++++++++++++++++++-
mm/damon/sysfs.c | 3 ++-
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/mm/damon/sysfs-common.h b/mm/damon/sysfs-common.h
index b3f63bc658b7..70d84bdc9f5f 100644
--- a/mm/damon/sysfs-common.h
+++ b/mm/damon/sysfs-common.h
@@ -48,7 +48,7 @@ void damon_sysfs_schemes_update_stats(
void damos_sysfs_populate_region_dir(struct damon_sysfs_schemes *sysfs_schemes,
struct damon_ctx *ctx, struct damon_target *t,
struct damon_region *r, struct damos *s,
- bool total_bytes_only);
+ bool total_bytes_only, unsigned long sz_filter_passed);
int damon_sysfs_schemes_clear_regions(
struct damon_sysfs_schemes *sysfs_schemes);
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index b447c412b02c..deeaf23c1fcf 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -19,6 +19,7 @@ struct damon_sysfs_scheme_region {
struct damon_addr_range ar;
unsigned int nr_accesses;
unsigned int age;
+ unsigned long sz_filter_passed;
struct list_head list;
};
@@ -74,6 +75,15 @@ static ssize_t age_show(struct kobject *kobj, struct kobj_attribute *attr,
return sysfs_emit(buf, "%u\n", region->age);
}
+static ssize_t sz_filter_passed_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ struct damon_sysfs_scheme_region *region = container_of(kobj,
+ struct damon_sysfs_scheme_region, kobj);
+
+ return sysfs_emit(buf, "%lu\n", region->sz_filter_passed);
+}
+
static void damon_sysfs_scheme_region_release(struct kobject *kobj)
{
struct damon_sysfs_scheme_region *region = container_of(kobj,
@@ -95,11 +105,15 @@ static struct kobj_attribute damon_sysfs_scheme_region_nr_accesses_attr =
static struct kobj_attribute damon_sysfs_scheme_region_age_attr =
__ATTR_RO_MODE(age, 0400);
+static struct kobj_attribute damon_sysfs_scheme_region_sz_filter_passed_attr =
+ __ATTR_RO_MODE(sz_filter_passed, 0400);
+
static struct attribute *damon_sysfs_scheme_region_attrs[] = {
&damon_sysfs_scheme_region_start_attr.attr,
&damon_sysfs_scheme_region_end_attr.attr,
&damon_sysfs_scheme_region_nr_accesses_attr.attr,
&damon_sysfs_scheme_region_age_attr.attr,
+ &damon_sysfs_scheme_region_sz_filter_passed_attr.attr,
NULL,
};
ATTRIBUTE_GROUPS(damon_sysfs_scheme_region);
@@ -2105,12 +2119,14 @@ void damon_sysfs_schemes_update_stats(
* @r: DAMON region to populate the directory for.
* @s: Corresponding scheme.
* @total_bytes_only: Whether the request is for bytes update only.
+ * @sz_filter_passed: Bytes of @r that passed filters of @s.
*
* Called from DAMOS walk callback while holding damon_sysfs_lock.
*/
void damos_sysfs_populate_region_dir(struct damon_sysfs_schemes *sysfs_schemes,
struct damon_ctx *ctx, struct damon_target *t,
- struct damon_region *r, struct damos *s, bool total_bytes_only)
+ struct damon_region *r, struct damos *s, bool total_bytes_only,
+ unsigned long sz_filter_passed)
{
struct damos *scheme;
struct damon_sysfs_scheme_regions *sysfs_regions;
@@ -2135,6 +2151,7 @@ void damos_sysfs_populate_region_dir(struct damon_sysfs_schemes *sysfs_schemes,
region = damon_sysfs_scheme_region_alloc(r);
if (!region)
return;
+ region->sz_filter_passed = sz_filter_passed;
list_add_tail(®ion->list, &sysfs_regions->regions_list);
sysfs_regions->nr_regions++;
if (kobject_init_and_add(®ion->kobj,
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 224873ca8aa6..deeab04d3b46 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1461,7 +1461,8 @@ static void damon_sysfs_schemes_tried_regions_upd_one(void *data, struct damon_c
damos_sysfs_populate_region_dir(
sysfs_kdamond->contexts->contexts_arr[0]->schemes,
- ctx, t, r, s, walk_data->total_bytes_only);
+ ctx, t, r, s, walk_data->total_bytes_only,
+ sz_filter_passed);
}
static int damon_sysfs_update_schemes_tried_regions(
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 14/16] Docs/mm/damon/design: document per-region sz_filter_passed stat
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (12 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 13/16] mm/damon/sysfs-schemes: expose per-region filter-passed bytes SeongJae Park
@ 2025-01-06 19:33 ` SeongJae Park
2025-01-06 19:34 ` [PATCH 15/16] Docs/admin-guide/mm/damon/usage: document sz_filtered_out of scheme tried region directories SeongJae Park
2025-01-06 19:34 ` [PATCH 16/16] Docs/ABI/damon: document per-region DAMOS filter-passed bytes stat file SeongJae Park
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:33 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, linux-doc, linux-kernel, linux-mm
Update 'Regions Walking' sectioin of design document for the newly added
per-region operations set handling DAMOS filters-passed bytes.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/mm/damon/design.rst | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index 68145972cb20..449eb33688c2 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -587,7 +587,8 @@ Regions Walking
DAMOS feature allowing users access each region that a DAMOS action has just
applied. Using this feature, DAMON :ref:`API <damon_design_api>` allows users
-access full properties of the regions including the access monitoring results.
+access full properties of the regions including the access monitoring results
+and amount of the region's internal memory that passed the DAMOS filters.
:ref:`DAMON sysfs interface <sysfs_interface>` also allows users read the data
via special :ref:`files <sysfs_schemes_tried_regions>`.
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 15/16] Docs/admin-guide/mm/damon/usage: document sz_filtered_out of scheme tried region directories
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (13 preceding siblings ...)
2025-01-06 19:33 ` [PATCH 14/16] Docs/mm/damon/design: document per-region sz_filter_passed stat SeongJae Park
@ 2025-01-06 19:34 ` SeongJae Park
2025-01-06 19:34 ` [PATCH 16/16] Docs/ABI/damon: document per-region DAMOS filter-passed bytes stat file SeongJae Park
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:34 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, linux-doc, linux-kernel, linux-mm
Document the newly added DAMON sysfs interface file for per-scheme-tried
region's bytes that passed the operations set handling DAMOS filters.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/admin-guide/mm/damon/usage.rst | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index 95c174be9c06..71cf29ae8502 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -86,7 +86,7 @@ comma (",").
│ │ │ │ │ │ │ │ 0/type,matching,memcg_id
│ │ │ │ │ │ │ :ref:`stats <sysfs_schemes_stats>`/nr_tried,sz_tried,nr_applied,sz_applied,sz_ops_filter_passed,qt_exceeds
│ │ │ │ │ │ │ :ref:`tried_regions <sysfs_schemes_tried_regions>`/total_bytes
- │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age
+ │ │ │ │ │ │ │ │ 0/start,end,nr_accesses,age,sz_filter_passed
│ │ │ │ │ │ │ │ ...
│ │ │ │ │ │ ...
│ │ │ │ ...
@@ -494,10 +494,10 @@ set the ``access pattern`` as their interested pattern that they want to query.
tried_regions/<N>/
------------------
-In each region directory, you will find four files (``start``, ``end``,
-``nr_accesses``, and ``age``). Reading the files will show the start and end
-addresses, ``nr_accesses``, and ``age`` of the region that corresponding
-DAMON-based operation scheme ``action`` has tried to be applied.
+In each region directory, you will find five files (``start``, ``end``,
+``nr_accesses``, ``age``, and ``sz_filter_passed``). Reading the files will
+show the properties of the region that corresponding DAMON-based operation
+scheme ``action`` has tried to be applied.
Example
~~~~~~~
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 16/16] Docs/ABI/damon: document per-region DAMOS filter-passed bytes stat file
2025-01-06 19:33 [PATCH 00/16] mm/damon: enable page level properties based monitoring SeongJae Park
` (14 preceding siblings ...)
2025-01-06 19:34 ` [PATCH 15/16] Docs/admin-guide/mm/damon/usage: document sz_filtered_out of scheme tried region directories SeongJae Park
@ 2025-01-06 19:34 ` SeongJae Park
15 siblings, 0 replies; 17+ messages in thread
From: SeongJae Park @ 2025-01-06 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-kernel, linux-mm
Document the new ABI for per-region operations set layer-handled DAMOS
filters passed bytes statistic.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/ABI/testing/sysfs-kernel-mm-damon | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon
index 19cde386fd15..8c0acb31638b 100644
--- a/Documentation/ABI/testing/sysfs-kernel-mm-damon
+++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon
@@ -430,3 +430,10 @@ Contact: SeongJae Park <sj@kernel.org>
Description: Reading this file returns the 'age' of a memory region that
corresponding DAMON-based Operation Scheme's action has tried
to be applied.
+
+What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/tried_regions/<R>/sz_filter_passed
+Date: Dec 2024
+Contact: SeongJae Park <sj@kernel.org>
+Description: Reading this file returns the size of the memory in the region
+ that passed DAMON operations layer-handled filters of the
+ scheme in bytes.
--
2.39.5
^ permalink raw reply [flat|nested] 17+ messages in thread