Skip to contentSkip to conversation

docs/mm/damon/design: add explanation of nr_snapshots

PATCH Superseded Liew Rui Yan 1 participant 5 messages Aug 12

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover docs/mm/damon/design: add explanation of nr_snapshots

Add an explanation of nr_snapshots to avoid misunderstandings.

Changes from v1:
- v1: https://lore.kernel.org/damon/[email protected]
- Patch 1 word order adjustment: Repositioned "completely" ("tried to be completely applied" -> "completely tried to be applied").
- Patch 2: Use two spaces between sentences.
- Patch 3: Add the "Reviewed-by:" of SJ, because he added this in v1.

Liew Rui Yan (3):
docs/mm/damon/design: accurate semantics of nr_snapshots docs/mm/damon/design: difference between watermarks and nr_snapshots docs/mm/damon/design: fix typo of max_nr_snapshots

 Documentation/mm/damon/design.rst | 7 ++++---
 include/linux/damon.h             | 5 +++--
 2 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH 1/3 docs/mm/damon/design: accurate semantics of nr_snapshots

Change "tried to be applied" -> "tried to be completely applied" to maintain consistency between the documentation and the code.

---
 Documentation/mm/damon/design.rst | 4 ++--
 include/linux/damon.h             | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
Documentation/mm/damon/design.rst +2 -2
index aed6cb1cf483..1739aeec6eb9 100644
@@ -846,8 +846,8 @@ scheme's execution.
 - ``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.
-- ``nr_snapshots``: Total number of DAMON snapshots that the scheme is tried to
-  be applied.
+- ``nr_snapshots``: Total number of DAMON snapshots that the scheme is
+  completely tried to be applied.
 - ``max_nr_snapshots``: Upper limit of ``nr_snapshots``.
 
 "A scheme is tried to be applied to a region" means DAMOS core logic determined
include/linux/damon.h +2 -1
index 0c8b7ddef9ab..33914594fb48 100644
@@ -357,7 +357,8 @@ struct damos_watermarks {
  *		Total bytes that passed ops layer-handled DAMOS filters.
  * @qt_exceeds: Total number of times the quota of the scheme has exceeded.
  * @nr_snapshots:
- *		Total number of DAMON snapshots that the scheme has tried.
+ *		Total number of DAMON snapshots that the scheme is completely
+ *		tried to be completely applied.
  *
  * "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
Signature · 1 line
2.55.0
#2 lore raw

PATCH 2/3 docs/mm/damon/design: difference between watermarks and nr_snapshots

In reply to Liew Rui Yan

Explain the difference between nr_snapshots reaches max_nr_snapshots and watermarks.

---
 Documentation/mm/damon/design.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/mm/damon/design.rst +2 -1
index 939298f2a9b9..1fcf0b8c044b 100644
@@ -872,7 +872,8 @@ the action to the region will fail.
 
 Unlike normal stats, ``max_nr_snapshots`` is set by users.  If it is set as
 non-zero and ``nr_snapshots`` be same to or greater than ``nr_snapshots``, the
-scheme is deactivated.
+scheme is deactivated.  Note that, unlike watermarks, even if a scheme's
+``nr_snapshots`` reaches ``max_nr_snapshots``, monitoring will not stop.
 
 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
Signature · 1 line
2.55.0
#3 lore raw

PATCH 3/3 docs/mm/damon/design: fix typo of max_nr_snapshots

In reply to Liew Rui Yan

Fixes a typo (nr_snapshots -> max_nr_snapshots) and corrects a grammar error.

---
 Documentation/mm/damon/design.rst | 4 ++--
 include/linux/damon.h             | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
Documentation/mm/damon/design.rst +2 -2
index 1fcf0b8c044b..62ba6cc2e999 100644
@@ -871,8 +871,8 @@ action is ``pageout`` while all pages of the region are unreclaimable, applying
 the action to the region will fail.
 
 Unlike normal stats, ``max_nr_snapshots`` is set by users.  If it is set as
-non-zero and ``nr_snapshots`` be same to or greater than ``nr_snapshots``, the
-scheme is deactivated. Note that, unlike watermarks, even if a scheme's
+non-zero and ``nr_snapshots`` equals or is greater than ``max_nr_snapshots``,
+the scheme is deactivated. Note that, unlike watermarks, even if a scheme's
 ``nr_snapshots`` reaches ``max_nr_snapshots``, monitoring will not stop.
 
 To know how user-space can read the stats via :ref:`DAMON sysfs interface
include/linux/damon.h +1 -1
index d642ce4fc83c..75ece3d03be2 100644
@@ -549,7 +549,7 @@ struct damos_migrate_dests {
  *
  * After applying the &action to each region, &stat is updated.
  *
- * If &max_nr_snapshots is set as non-zero and &stat.nr_snapshots be same to or
+ * If &max_nr_snapshots is set as non-zero and &stat.nr_snapshots equals or is
  * greater than it, the scheme is deactivated.
  */
 struct damos {
Signature · 1 line
2.55.0
#4 lore raw
In reply to Liew Rui Yan
Quoted 10 lines · On Tue, 11 Aug 2026 18:18:38 +0800 Liew Rui Yan <[email protected]>…

Add an explanation of nr_snapshots to avoid misunderstandings.

Liew Rui Yan (3):
docs/mm/damon/design: accurate semantics of nr_snapshots docs/mm/damon/design: difference between watermarks and nr_snapshots docs/mm/damon/design: fix typo of max_nr_snapshots

 Documentation/mm/damon/design.rst | 7 ++++---
 include/linux/damon.h             | 5 +++--
 2 files changed, 7 insertions(+), 5 deletions(-)

This patch series still contain some error, I will resend them later. Please skip reviewing these patches. Apologize for the noise.