Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm/damon: fix macro arguments and clarify quota goals doc
@ 2026-05-21 20:20 Maksym Shcherba
  2026-05-21 20:20 ` [PATCH v2 1/2] mm/damon: fix missing parens in macro arguments Maksym Shcherba
  2026-05-21 20:20 ` [PATCH v2 2/2] Docs/admin-guide/mm/damon/usage: clarify current_value of quota goals Maksym Shcherba
  0 siblings, 2 replies; 4+ messages in thread
From: Maksym Shcherba @ 2026-05-21 20:20 UTC (permalink / raw)
  To: SeongJae Park
  Cc: Maksym Shcherba, Liam R. Howlett, Andrew Morton,
	David Hildenbrand, Jonathan Corbet, Lorenzo Stoakes, Michal Hocko,
	Mike Rapoport, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
	damon, linux-doc, linux-kernel, linux-mm

- Patch 1 fixes missing parentheses in DAMON iterator macro arguments to
  prevent potential build failures.
- Patch 2 clarifies in the sysfs documentation that the `current_value` of
  quota goals is only for user input and is not updated by the kernel.

Changes from v1
- v1: https://lore.kernel.org/r/20260518190932.42270-1-maksym.shcherba@lnu.edu.ua/
- Drop patches 2, 3, 5, and 6 from v1 (which implemented and documented
  update_schemes_quota_goals).
- Clarify `current_value` behavior in the documentation (Patch 2) instead
  of modifying the sysfs API.
- Add SeongJae's Reviewed-by tag to the macro bugfix (Patch 1).
- Fix checkpatch.pl email address mismatch warning.

Maksym Shcherba (2):
  mm/damon: fix missing parens in macro arguments
  Docs/admin-guide/mm/damon/usage: clarify current_value of quota goals

 Documentation/admin-guide/mm/damon/usage.rst | 6 ++++--
 include/linux/damon.h                        | 8 ++++----
 2 files changed, 8 insertions(+), 6 deletions(-)


base-commit: 85a7d9e080a3f65869f22c2d50b630462fce332b
-- 
2.34.1


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

* [PATCH v2 1/2] mm/damon: fix missing parens in macro arguments
  2026-05-21 20:20 [PATCH v2 0/2] mm/damon: fix macro arguments and clarify quota goals doc Maksym Shcherba
@ 2026-05-21 20:20 ` Maksym Shcherba
  2026-05-21 20:20 ` [PATCH v2 2/2] Docs/admin-guide/mm/damon/usage: clarify current_value of quota goals Maksym Shcherba
  1 sibling, 0 replies; 4+ messages in thread
From: Maksym Shcherba @ 2026-05-21 20:20 UTC (permalink / raw)
  To: SeongJae Park; +Cc: Maksym Shcherba, damon, linux-kernel, linux-mm

The DAMON iterator macros do not wrap their pointer arguments with
parentheses. This can cause build failures when the argument is a
complex expression due to operator precedence issues.

Add missing parentheses around the arguments in the following macros
to prevent potential build failures:
- damon_for_each_region()
- damon_for_each_region_from()
- damon_for_each_region_safe()
- damos_for_each_quota_goal()

Assisted-by: Antigravity:Gemini-3.1-Pro
Signed-off-by: Maksym Shcherba <maksym.shcherba@lnu.edu.ua>
Reviewed-by: SeongJae Park <sj@kernel.org>
---
 include/linux/damon.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/damon.h b/include/linux/damon.h
index df7910a39b40..abb0bbc26997 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -1098,13 +1098,13 @@ static inline unsigned long damon_sz_region(struct damon_region *r)
 	list_for_each_entry_safe(p, next, &(ctx)->probes, list)
 
 #define damon_for_each_region(r, t) \
-	list_for_each_entry(r, &t->regions_list, list)
+	list_for_each_entry(r, &(t)->regions_list, list)
 
 #define damon_for_each_region_from(r, t) \
-	list_for_each_entry_from(r, &t->regions_list, list)
+	list_for_each_entry_from(r, &(t)->regions_list, list)
 
 #define damon_for_each_region_safe(r, next, t) \
-	list_for_each_entry_safe(r, next, &t->regions_list, list)
+	list_for_each_entry_safe(r, next, &(t)->regions_list, list)
 
 #define damon_for_each_target(t, ctx) \
 	list_for_each_entry(t, &(ctx)->adaptive_targets, list)
@@ -1125,7 +1125,7 @@ static inline unsigned long damon_sz_region(struct damon_region *r)
 	list_for_each_entry_safe(s, next, &(ctx)->schemes, list)
 
 #define damos_for_each_quota_goal(goal, quota) \
-	list_for_each_entry(goal, &quota->goals, list)
+	list_for_each_entry(goal, &(quota)->goals, list)
 
 #define damos_for_each_quota_goal_safe(goal, next, quota) \
 	list_for_each_entry_safe(goal, next, &(quota)->goals, list)
-- 
2.34.1


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

* [PATCH v2 2/2] Docs/admin-guide/mm/damon/usage: clarify current_value of quota goals
  2026-05-21 20:20 [PATCH v2 0/2] mm/damon: fix macro arguments and clarify quota goals doc Maksym Shcherba
  2026-05-21 20:20 ` [PATCH v2 1/2] mm/damon: fix missing parens in macro arguments Maksym Shcherba
@ 2026-05-21 20:20 ` Maksym Shcherba
  2026-05-22  2:00   ` SeongJae Park
  1 sibling, 1 reply; 4+ messages in thread
From: Maksym Shcherba @ 2026-05-21 20:20 UTC (permalink / raw)
  To: SeongJae Park
  Cc: Maksym Shcherba, Liam R. Howlett, Andrew Morton,
	David Hildenbrand, Jonathan Corbet, Lorenzo Stoakes, Michal Hocko,
	Mike Rapoport, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
	damon, linux-doc, linux-kernel, linux-mm

The sysfs interface for DAMON quota goals includes a `current_value` file.
This file is not updated by the kernel and only serves to receive user
input.

Clarify in the documentation that the kernel does not update
`current_value`, and that reading it only has meaning when `target_metric`
is set to `user_input`.

While at it, fix missing commas in the goal files list.

Assisted-by: Antigravity:Gemini-3.1-Pro
Signed-off-by: Maksym Shcherba <maksym.shcherba@lnu.edu.ua>
---
 Documentation/admin-guide/mm/damon/usage.rst | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/admin-guide/mm/damon/usage.rst
index e3e2ccab218a..5b85a7a2ddf0 100644
--- a/Documentation/admin-guide/mm/damon/usage.rst
+++ b/Documentation/admin-guide/mm/damon/usage.rst
@@ -511,10 +511,12 @@ to ``N-1``.  Each directory represents each goal and current achievement.
 Among the multiple feedback, the best one is used.
 
 Each goal directory contains five files, namely ``target_metric``,
-``target_value``, ``current_value`` ``nid`` and ``path``.  Users can set and
+``target_value``, ``current_value``, ``nid``, and ``path``.  Users can set and
 get the five parameters for the quota auto-tuning goals that specified on the
 :ref:`design doc <damon_design_damos_quotas_auto_tuning>` by writing to and
-reading from each of the files.  Note that users should further write
+reading from each of the files.  Because the kernel does not update
+``current_value``, reading it only makes sense when ``target_metric`` is
+``user_input``.  Note that users should further write
 ``commit_schemes_quota_goals`` to the ``state`` file of the :ref:`kdamond
 directory <sysfs_kdamond>` to pass the feedback to DAMON.
 
-- 
2.34.1


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

* Re: [PATCH v2 2/2] Docs/admin-guide/mm/damon/usage: clarify current_value of quota goals
  2026-05-21 20:20 ` [PATCH v2 2/2] Docs/admin-guide/mm/damon/usage: clarify current_value of quota goals Maksym Shcherba
@ 2026-05-22  2:00   ` SeongJae Park
  0 siblings, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2026-05-22  2:00 UTC (permalink / raw)
  To: Maksym Shcherba
  Cc: SeongJae Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
	Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
	Shuah Khan, Suren Baghdasaryan, Vlastimil Babka, damon, linux-doc,
	linux-kernel, linux-mm

On Thu, 21 May 2026 23:20:20 +0300 Maksym Shcherba <maksym.shcherba@lnu.edu.ua> wrote:

> The sysfs interface for DAMON quota goals includes a `current_value` file.
> This file is not updated by the kernel and only serves to receive user
> input.
> 
> Clarify in the documentation that the kernel does not update
> `current_value`, and that reading it only has meaning when `target_metric`
> is set to `user_input`.
> 
> While at it, fix missing commas in the goal files list.

Nice!  Thank you for doing these!

> 
> Assisted-by: Antigravity:Gemini-3.1-Pro
> Signed-off-by: Maksym Shcherba <maksym.shcherba@lnu.edu.ua>

Reviewed-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

[...]


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

end of thread, other threads:[~2026-05-22  2:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-21 20:20 [PATCH v2 0/2] mm/damon: fix macro arguments and clarify quota goals doc Maksym Shcherba
2026-05-21 20:20 ` [PATCH v2 1/2] mm/damon: fix missing parens in macro arguments Maksym Shcherba
2026-05-21 20:20 ` [PATCH v2 2/2] Docs/admin-guide/mm/damon/usage: clarify current_value of quota goals Maksym Shcherba
2026-05-22  2:00   ` SeongJae Park

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