]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mm/damon: unify address range representation with damon_addr_range
authorEnze Li <lienze@kylinos.cn>
Thu, 29 Jan 2026 10:08:45 +0000 (18:08 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 6 Feb 2026 23:47:15 +0000 (15:47 -0800)
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.

Link: https://lkml.kernel.org/r/20260129100845.281734-1-lienze@kylinos.cn
Signed-off-by: Enze Li <lienze@kylinos.cn>
Reviewed-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/core.c

index 70efbf22a2b4e95227ec7bbea50b6db6ebda833f..5e2724a4f285e1d8f92c5a61cf5e6e0296266af5 100644 (file)
@@ -2856,20 +2856,9 @@ done:
        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)