linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/damon: unify address range representation with damon_addr_range
@ 2026-01-29 10:08 Enze Li
  2026-01-29 16:10 ` SeongJae Park
  0 siblings, 1 reply; 6+ messages in thread
From: Enze Li @ 2026-01-29 10:08 UTC (permalink / raw)
  To: sj, akpm; +Cc: damon, linux-mm, enze.li, Enze Li

Currently, DAMON defines two identical structures for representing
address ranges: damon_system_ram_region and damon_addr_range.  Both
structures share the same semantic interpretation of a half-open
interval [start, end), where the start address is inclusive and the end
address is exclusive.

This duplication adds unnecessary redundancy and increases maintenance
overhead.  This patch replaces all uses of damon_system_ram_region with
the more generic damon_addr_range structure, ensuring a unified type
representation for address ranges within the DAMON subsystem.  The
change simplifies the codebase, improves readability, and avoids
potential inconsistencies in future modifications.

Signed-off-by: Enze Li <lienze@kylinos.cn>
---
 mm/damon/core.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index 70efbf22a2b4..5e2724a4f285 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2856,20 +2856,9 @@ static int kdamond_fn(void *data)
 	return 0;
 }
 
-/*
- * struct damon_system_ram_region - System RAM resource address region of
- *				    [@start, @end).
- * @start:	Start address of the region (inclusive).
- * @end:	End address of the region (exclusive).
- */
-struct damon_system_ram_region {
-	unsigned long start;
-	unsigned long end;
-};
-
 static int walk_system_ram(struct resource *res, void *arg)
 {
-	struct damon_system_ram_region *a = arg;
+	struct damon_addr_range *a = arg;
 
 	if (a->end - a->start < resource_size(res)) {
 		a->start = res->start;
@@ -2886,7 +2875,7 @@ static bool damon_find_biggest_system_ram(unsigned long *start,
 						unsigned long *end)
 
 {
-	struct damon_system_ram_region arg = {};
+	struct damon_addr_range arg = {};
 
 	walk_system_ram_res(0, ULONG_MAX, &arg, walk_system_ram);
 	if (arg.end <= arg.start)

base-commit: 0241748f8b68fc2bf637f4901b9d7ca660d177ca
-- 
2.52.0



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

end of thread, other threads:[~2026-01-31  1:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-29 10:08 [PATCH] mm/damon: unify address range representation with damon_addr_range Enze Li
2026-01-29 16:10 ` SeongJae Park
2026-01-30  2:26   ` Quanmin Yan
2026-01-30  3:07     ` Quanmin Yan
2026-01-30  3:38       ` SeongJae Park
2026-01-31  1:56         ` SeongJae Park

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