From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>,
Quanmin Yan <yanquanmin1@huawei.com>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, wangkefeng.wang@huawei.com,
zuoze1@huawei.com
Subject: [PATCH v3 01/11] mm/damon/core: add damon_ctx->addr_unit
Date: Thu, 28 Aug 2025 10:12:32 -0700 [thread overview]
Message-ID: <20250828171242.59810-2-sj@kernel.org> (raw)
In-Reply-To: <20250828171242.59810-1-sj@kernel.org>
In some cases, some of the real address that handled by the underlying
operations set cannot be handled by DAMON since it uses only 'unsinged
long' as the address type. Using DAMON for physical address space
monitoring of 32 bit ARM devices with large physical address extension
(LPAE) is one example[1].
Add a parameter name 'addr_unit' to core layer to help such cases.
DAMON core API callers can set it as the scale factor that will be used
by the operations set for translating the core layer's addresses to the
real address by multiplying the parameter value to the core layer
address. Support of the parameter is up to each operations set layer.
The support from the physical address space operations set (paddr) will
be added with following commits.
[1] https://lore.kernel.org/20250408075553.959388-1-zuoze1@huawei.com
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 3 ++-
mm/damon/core.c | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index d01bfee80bd6..6fa52f7495d9 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -746,7 +746,7 @@ struct damon_attrs {
* Accesses to other fields must be protected by themselves.
*
* @ops: Set of monitoring operations for given use cases.
- *
+ * @addr_unit: Scale factor for core to ops address conversion.
* @adaptive_targets: Head of monitoring targets (&damon_target) list.
* @schemes: Head of schemes (&damos) list.
*/
@@ -788,6 +788,7 @@ struct damon_ctx {
struct mutex kdamond_lock;
struct damon_operations ops;
+ unsigned long addr_unit;
struct list_head adaptive_targets;
struct list_head schemes;
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 5ac1433860a3..acea2964b9cc 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -544,6 +544,8 @@ struct damon_ctx *damon_new_ctx(void)
ctx->attrs.min_nr_regions = 10;
ctx->attrs.max_nr_regions = 1000;
+ ctx->addr_unit = 1;
+
INIT_LIST_HEAD(&ctx->adaptive_targets);
INIT_LIST_HEAD(&ctx->schemes);
@@ -1245,6 +1247,7 @@ int damon_commit_ctx(struct damon_ctx *dst, struct damon_ctx *src)
return err;
}
dst->ops = src->ops;
+ dst->addr_unit = src->addr_unit;
return 0;
}
--
2.39.5
next prev parent reply other threads:[~2025-08-28 17:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-28 17:12 [PATCH v3 00/11] mm/damon: support ARM32 with LPAE SeongJae Park
2025-08-28 17:12 ` SeongJae Park [this message]
2025-08-28 17:12 ` [PATCH v3 02/11] mm/damon/paddr: support addr_unit for access monitoring SeongJae Park
2025-08-28 17:12 ` [PATCH v3 03/11] mm/damon/paddr: support addr_unit for DAMOS_PAGEOUT SeongJae Park
2025-08-28 17:12 ` [PATCH v3 04/11] mm/damon/paddr: support addr_unit for DAMOS_LRU_[DE]PRIO SeongJae Park
2025-08-28 17:12 ` [PATCH v3 05/11] mm/damon/paddr: support addr_unit for MIGRATE_{HOT,COLD} SeongJae Park
2025-08-28 17:12 ` [PATCH v3 06/11] mm/damon/paddr: support addr_unit for DAMOS_STAT SeongJae Park
2025-08-28 17:12 ` [PATCH v3 07/11] mm/damon/sysfs: implement addr_unit file under context dir SeongJae Park
2025-08-28 17:12 ` [PATCH v3 08/11] Docs/mm/damon/design: document 'address unit' parameter SeongJae Park
2025-08-28 17:12 ` [PATCH v3 09/11] Docs/admin-guide/mm/damon/usage: document addr_unit file SeongJae Park
2025-08-28 17:12 ` [PATCH v3 10/11] Docs/ABI/damon: " SeongJae Park
2025-08-28 17:12 ` [PATCH v3 11/11] mm/damon: add damon_ctx->min_sz_region SeongJae Park
2025-09-17 16:00 ` SeongJae Park
2025-09-17 21:29 ` Andrew Morton
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=20250828171242.59810-2-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 \
--cc=wangkefeng.wang@huawei.com \
--cc=yanquanmin1@huawei.com \
--cc=zuoze1@huawei.com \
/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