From: SeongJae Park <sj@kernel.org>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: [RFC PATCH 3/5] mm/damon/core: receive addr_unit on damon_set_region_biggest_system_ram_default()
Date: Wed, 4 Mar 2026 21:39:15 -0800 [thread overview]
Message-ID: <20260305053918.83786-4-sj@kernel.org> (raw)
In-Reply-To: <20260305053918.83786-1-sj@kernel.org>
damon_find_biggest_system_ram() was not supporting addr_unit in the
past. Hence, its caller, damon_set_region_biggest_system_ram_default(),
was also not supporting addr_unit. The previous commit has updated the
inner function to support addr_unit. There is no reason to support
addr_unit on damon_set_region_biggest_system_ram_default(). Update it
to receive addr_unit and handle it inside. Update callers of the
function to pass value '1' to addr_unit parameter, though. to avoid
unnecessary behavioral change.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 1 +
mm/damon/core.c | 7 ++++---
mm/damon/lru_sort.c | 1 +
mm/damon/reclaim.c | 1 +
mm/damon/stat.c | 2 +-
5 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index c4095b34f7929..c269b0c93f9df 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -985,6 +985,7 @@ int damos_walk(struct damon_ctx *ctx, struct damos_walk_control *control);
int damon_set_region_biggest_system_ram_default(struct damon_target *t,
unsigned long *start, unsigned long *end,
+ unsigned long addr_unit,
unsigned long min_region_sz);
#endif /* CONFIG_DAMON */
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 38c7a919f9bb2..ce19d751f5102 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -3099,6 +3099,7 @@ static bool damon_find_biggest_system_ram(unsigned long *start,
* @t: The monitoring target to set the region.
* @start: The pointer to the start address of the region.
* @end: The pointer to the end address of the region.
+ * @addr_unit: The address unit for the damon_ctx of @t.
* @min_region_sz: Minimum region size.
*
* This function sets the region of @t as requested by @start and @end. If the
@@ -3111,7 +3112,7 @@ static bool damon_find_biggest_system_ram(unsigned long *start,
*/
int damon_set_region_biggest_system_ram_default(struct damon_target *t,
unsigned long *start, unsigned long *end,
- unsigned long min_region_sz)
+ unsigned long addr_unit, unsigned long min_region_sz)
{
struct damon_addr_range addr_range;
@@ -3119,12 +3120,12 @@ int damon_set_region_biggest_system_ram_default(struct damon_target *t,
return -EINVAL;
if (!*start && !*end &&
- !damon_find_biggest_system_ram(start, end, 1))
+ !damon_find_biggest_system_ram(start, end, addr_unit))
return -EINVAL;
addr_range.start = *start;
addr_range.end = *end;
- return damon_set_regions(t, &addr_range, 1, min_region_sz);
+ return damon_set_regions(t, &addr_range, addr_unit, min_region_sz);
}
/*
diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index 7bc5c0b2aea3e..133ea17e258df 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -345,6 +345,7 @@ static int damon_lru_sort_apply_parameters(void)
err = damon_set_region_biggest_system_ram_default(param_target,
&monitor_region_start,
&monitor_region_end,
+ param_ctx->addr_unit,
param_ctx->min_region_sz);
if (err)
goto out;
diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c
index 43d76f5bed449..01f2f6cdbcdfe 100644
--- a/mm/damon/reclaim.c
+++ b/mm/damon/reclaim.c
@@ -251,6 +251,7 @@ static int damon_reclaim_apply_parameters(void)
err = damon_set_region_biggest_system_ram_default(param_target,
&monitor_region_start,
&monitor_region_end,
+ param_ctx->addr_unit,
param_ctx->min_region_sz);
if (err)
goto out;
diff --git a/mm/damon/stat.c b/mm/damon/stat.c
index 25fb44ccf99d0..f9a2028483b05 100644
--- a/mm/damon/stat.c
+++ b/mm/damon/stat.c
@@ -181,7 +181,7 @@ static struct damon_ctx *damon_stat_build_ctx(void)
goto free_out;
damon_add_target(ctx, target);
if (damon_set_region_biggest_system_ram_default(target, &start, &end,
- ctx->min_region_sz))
+ ctx->addr_unit, ctx->min_region_sz))
goto free_out;
return ctx;
free_out:
--
2.47.3
next prev parent reply other threads:[~2026-03-05 5:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 5:39 [RFC PATCH 0/5] mm/damon: support addr_unit on default monitoring targets for modules SeongJae Park
2026-03-05 5:39 ` [RFC PATCH 1/5] mm/damon/core: fix wrong end address assignment on walk_system_ram() SeongJae Park
2026-03-05 5:39 ` [RFC PATCH 2/5] mm/damon/core: support addr_unit on damon_find_biggest_system_ram() SeongJae Park
2026-03-05 5:39 ` SeongJae Park [this message]
2026-03-05 5:39 ` [RFC PATCH 4/5] mm/damon/reclaim: respect addr_unit on default monitoring region setup SeongJae Park
2026-03-05 5:39 ` [RFC PATCH 5/5] mm/damon/lru_sort: " SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260305053918.83786-4-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox