mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] mm/damon: cleanup region iterator and damon_reclaim user doc
@ 2026-11-10  1:05 SJ Park
  2026-11-10  1:05 ` [PATCH 1/2] mm/damon/core: use list_{next,prev}_entry() in damon_{next,prev}_region() SJ Park
  2026-11-10  1:05 ` [PATCH 2/2] Docs/admin-guide/mm/damon/reclaim: improve language SJ Park
  0 siblings, 2 replies; 3+ messages in thread
From: SJ Park @ 2026-11-10  1:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: SJ Park, Aveline Noir, Jonathan Corbet, Randy Dunlap, Shuah Khan,
	damon, linux-doc, linux-kernel, linux-mm

Two simple cleanups.  Use dedicated next/prev list entry accessors in
damon_{next,prev}_region() for code maintainability (patch 1, Enze Li).
Fix typos, grammars and improve overall readability of DAMON_RECLAIM
user document (patch 2, Manuel Ebner).

Reviewer notes.  This is a batched mm.git merge request-purpose repost
of DAMON patches that was sent by individual contributors.  For
changelog, refer to those in each patch.

Enze Li (1):
  mm/damon/core: use list_{next,prev}_entry() in
    damon_{next,prev}_region()

Manuel Ebner (1):
  Docs/admin-guide/mm/damon/reclaim: improve language

 .../admin-guide/mm/damon/reclaim.rst          | 45 ++++++++++---------
 include/linux/damon.h                         |  4 +-
 2 files changed, 25 insertions(+), 24 deletions(-)


base-commit: 7564fa11d57d7be37aaf791ff683099098dd2e39
-- 
2.47.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] mm/damon/core: use list_{next,prev}_entry() in damon_{next,prev}_region()
  2026-11-10  1:05 [PATCH 0/2] mm/damon: cleanup region iterator and damon_reclaim user doc SJ Park
@ 2026-11-10  1:05 ` SJ Park
  2026-11-10  1:05 ` [PATCH 2/2] Docs/admin-guide/mm/damon/reclaim: improve language SJ Park
  1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-11-10  1:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Enze Li, SJ Park, damon, linux-kernel, linux-mm

From: Enze Li <lienze@kylinos.cn>

damon_next_region() and damon_prev_region() manually do container_of()
type casting to fetch the next and previous region from the linked
list.  Use the dedicated list.h helpers, list_next_entry() and
list_prev_entry(), as damon_first_region() and damon_last_region() do.

Signed-off-by: Enze Li <lienze@kylinos.cn>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Changes from v1
- v1: https://lore.kernel.org/20261103100714.70742-1-lienze@kylinos.cn
- Collect R-b: from SJ.
- Rebase to the latest mm-new.

 include/linux/damon.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/damon.h b/include/linux/damon.h
index 1302ffb6f0bcb..c32ef79c3acea 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -992,12 +992,12 @@ static inline unsigned long damon_rand(struct damon_ctx *ctx,
 
 static inline struct damon_region *damon_next_region(struct damon_region *r)
 {
-	return container_of(r->list.next, struct damon_region, list);
+	return list_next_entry(r, list);
 }
 
 static inline struct damon_region *damon_prev_region(struct damon_region *r)
 {
-	return container_of(r->list.prev, struct damon_region, list);
+	return list_prev_entry(r, list);
 }
 
 static inline struct damon_region *damon_last_region(struct damon_target *t)
-- 
2.47.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Docs/admin-guide/mm/damon/reclaim: improve language
  2026-11-10  1:05 [PATCH 0/2] mm/damon: cleanup region iterator and damon_reclaim user doc SJ Park
  2026-11-10  1:05 ` [PATCH 1/2] mm/damon/core: use list_{next,prev}_entry() in damon_{next,prev}_region() SJ Park
@ 2026-11-10  1:05 ` SJ Park
  1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-11-10  1:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Manuel Ebner, Aveline Noir, Jonathan Corbet, Randy Dunlap,
	SJ Park, Shuah Khan, damon, linux-doc, linux-kernel, linux-mm

From: Manuel Ebner <manuelebnerli@mailbox.org>

Fix upper case.  Fix tenses.  Replace 'set as' with 'set to'.  Add space
after sentence to make it double space.  Rewrite and refine complex
sentences.

Cc: Aveline Noir <jm5905938@gmail.com>
Signed-off-by: Manuel Ebner <manuelebnerli@mailbox.org>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Changes from v3
- v3: https://lore.kernel.org/20261103120043.100887-2-manuelebnerli@mailbox.org
- Apply two Sashiko suggestions.
- Collect R-b: from SJ.
- Rebase to the latest mm-new.
- Wrap commit message for 75 characters limit.

[v3]
 Combine both patches into one
 Incorporate SJ's feedback

[v2]
 https://lore.kernel.org/all/20261027185938.2526259-2-manuelebnerli@mailbox.org/
 Include suggestions from SJ and Aveline
 Split [v1] into
  [1/2 v2] Docs/admin-guide/mm/damon/reclaim: improve grammar and style
  [2/2 v2] Docs/admin-guide/mm/damon/reclaim: rewrite complex parts
 Fixed an upper case and a missing double space -> [1/2 v2]

[v1]
 https://lore.kernel.org/all/20261015080623.808458-2-manuelebnerli@mailbox.org/

 .../admin-guide/mm/damon/reclaim.rst          | 45 ++++++++++---------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/Documentation/admin-guide/mm/damon/reclaim.rst b/Documentation/admin-guide/mm/damon/reclaim.rst
index 028947f5da8ec..0ef784df98680 100644
--- a/Documentation/admin-guide/mm/damon/reclaim.rst
+++ b/Documentation/admin-guide/mm/damon/reclaim.rst
@@ -4,7 +4,7 @@
 DAMON-based Reclamation
 =======================
 
-DAMON-based Reclamation (DAMON_RECLAIM) is a static kernel module that aimed to
+DAMON-based reclamation (DAMON_RECLAIM) is a static kernel module that aims to
 be used for proactive and lightweight reclamation under light memory pressure.
 It doesn't aim to replace the LRU-list based page_granularity reclamation, but
 to be selectively used for different level of memory pressure and requirements.
@@ -30,12 +30,13 @@ guests could mitigate this problem.
 How It Works?
 =============
 
-DAMON_RECLAIM finds memory regions that didn't accessed for specific time
-duration and page out.  To avoid it consuming too much CPU for the paging out
-operation, a speed limit can be configured.  Under the speed limit, it pages
-out memory regions that didn't accessed longer time first.  System
-administrators can also configure under what situation this scheme should
-automatically activated and deactivated with three memory pressure watermarks.
+DAMON_RECLAIM finds memory regions that have not been accessed for a
+specified period and attempts to page out those.  To avoid it consuming
+too much CPU for the paging out operation, a speed limit can be configured.
+Within the configured speed limit, it prioritizes regions that have been
+idle longer for reclamation.  System administrators can also configure under
+what situation this scheme should automatically be activated and deactivated
+with three memory pressure watermarks.
 
 Interface: Module Parameters
 ============================
@@ -55,10 +56,10 @@ enabled
 
 Enable or disable DAMON_RECLAIM.
 
-You can enable DAMON_RECLAIM by setting the value of this parameter as ``Y``.
-Setting it as ``N`` disables DAMON_RECLAIM.  Note that DAMON_RECLAIM could do
+You can enable DAMON_RECLAIM by setting the value of this parameter to ``Y``.
+Setting it to ``N`` disables DAMON_RECLAIM.  Note that DAMON_RECLAIM could do
 no real monitoring and reclamation due to the watermarks-based activation
-condition.  Refer to below descriptions for the watermarks parameter for this.
+condition.  Refer to below descriptions of the watermarks parameter for this.
 
 commit_inputs
 -------------
@@ -66,9 +67,9 @@ commit_inputs
 Make DAMON_RECLAIM reads the input parameters again, except ``enabled``.
 
 Input parameters that updated while DAMON_RECLAIM is running are not applied
-by default.  Once this parameter is set as ``Y``, DAMON_RECLAIM reads values
+by default.  Once this parameter is set to ``Y``, DAMON_RECLAIM reads values
 of parameters except ``enabled`` again.  Once the re-reading is done, this
-parameter is set as ``N``.  If invalid parameters are found while the
+parameter is set to ``N``.  If invalid parameters are found while the
 re-reading, DAMON_RECLAIM will be disabled.
 
 Once ``Y`` is written to this parameter, the user must not write to any
@@ -88,10 +89,10 @@ identifies the region as cold, and reclaims it.
 autotune_monitoring_intervals
 -----------------------------
 
-If this parameter is set as ``Y``, DAMON_RECLAIM automatically tunes DAMON's
+If this parameter is set to ``Y``, DAMON_RECLAIM automatically tunes DAMON's
 sampling and aggregation intervals.  The auto-tuning aims to capture meaningful
 amount of access events in each DAMON-snapshot, while keeping the sampling
-interval 5 milliseconds in minimum, and 10 seconds in maximum.  Setting this as
+interval 5 milliseconds in minimum, and 10 seconds in maximum.  Setting this to
 ``N`` disables the auto-tuning.
 
 Disabled by default.
@@ -113,10 +114,10 @@ quota_sz
 
 Limit of size of memory for the reclamation in bytes.
 
-DAMON_RECLAIM charges amount of memory which it tried to reclaim within a time
-window (quota_reset_interval_ms) and makes no more than this limit is tried.
-This can be used for limiting consumption of CPU and IO.  If this value is
-zero, the limit is disabled.
+DAMON_RECLAIM charges the amount of memory which it tried to reclaim within a time
+window (quota_reset_interval_ms) and stops trying to reclaim memory when this limit
+is reached.  This can be used for limiting consumption of CPU and IO.  If this value
+is zero, the limit is disabled.
 
 128 MiB by default.
 
@@ -137,7 +138,7 @@ quota_mem_pressure_us
 
 Desired level of memory pressure-stall time in microseconds.
 
-While keeping the caps that set by other quotas, DAMON_RECLAIM automatically
+While keeping the caps that are set by other quotas, DAMON_RECLAIM automatically
 increases and decreases the effective level of the quota aiming this level of
 memory pressure is incurred.  System-wide ``some`` memory PSI in microseconds
 per quota reset interval (``quota_reset_interval_ms``) is collected and
@@ -223,7 +224,7 @@ monitoring.  This can be used to set lower-bound of the monitoring quality.
 But, setting this too high could result in increased monitoring overhead.
 Please refer to the DAMON documentation (:doc:`usage`) for more detail.
 
-Note that this must be 3 or higher. Please refer to the :ref:`Monitoring
+Note that this must be 3 or higher.  Please refer to the :ref:`Monitoring
 <damon_design_monitoring>` section of the design document for the rationale
 behind this lower bound.
 
@@ -267,7 +268,7 @@ This parameter is for setting and getting the :ref:`address unit
 
 ``monitor_region_start`` and ``monitor_region_end`` should be provided in this
 unit.  For example, let's suppose ``addr_unit``, ``monitor_region_start`` and
-``monitor_region_end`` are set as ``1024``, ``0`` and ``10``, respectively.
+``monitor_region_end`` are set to ``1024``, ``0`` and ``10``, respectively.
 Then DAMON_RECLAIM will work for 10 KiB length of physical address range that
 starts from address zero (``[0 * 1024, 10 * 1024)`` in bytes).
 
@@ -284,7 +285,7 @@ skip_anon
 
 Skip anonymous pages reclamation.
 
-If this parameter is set as ``Y``, DAMON_RECLAIM does not reclaim anonymous
+If this parameter is set to ``Y``, DAMON_RECLAIM does not reclaim anonymous
 pages.  By default, ``N``.
 
 
-- 
2.47.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-10  1:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10  1:05 [PATCH 0/2] mm/damon: cleanup region iterator and damon_reclaim user doc SJ Park
2026-11-10  1:05 ` [PATCH 1/2] mm/damon/core: use list_{next,prev}_entry() in damon_{next,prev}_region() SJ Park
2026-11-10  1:05 ` [PATCH 2/2] Docs/admin-guide/mm/damon/reclaim: improve language SJ Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®