Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/core: add damon_ctx->addr_unit

Patch series "mm/damon: support ARM32 with LPAE", v3.

Previously, DAMON's physical address space monitoring only supported
memory ranges below 4GB on LPAE-enabled systems. This was due to the use
of 'unsigned long' in 'struct damon_addr_range', which is 32-bit on ARM32
even with LPAE enabled[1].

To add DAMON support for ARM32 with LPAE enabled, a new core layer
parameter called 'addr_unit' was introduced[2]. Operations set layer can
translate a core layer address to the real address by multiplying the
parameter value to the core layer address. Support of the parameter is up
to each operations layer implementation, though. For example, operations
set implementations for virtual address space can simply ignore the
parameter. Add the support on paddr, which is the DAMON operations set
implementation for the physical address space, as we have a clear use case
for that.


This patch (of 11):

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.

Link: https://lkml.kernel.org/r/20250828171242.59810-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20250828171242.59810-2-sj@kernel.org
Link: https://lore.kernel.org/20250408075553.959388-1-zuoze1@huawei.com [1]
Link: https://lore.kernel.org/all/20250416042551.158131-1-sj@kernel.org/ [2]
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: ze zuo <zuoze1@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
09a616cb 98c94f10

+5 -1
+2 -1
include/linux/damon.h
··· 746 746 * Accesses to other fields must be protected by themselves. 747 747 * 748 748 * @ops: Set of monitoring operations for given use cases. 749 - * 749 + * @addr_unit: Scale factor for core to ops address conversion. 750 750 * @adaptive_targets: Head of monitoring targets (&damon_target) list. 751 751 * @schemes: Head of schemes (&damos) list. 752 752 */ ··· 788 788 struct mutex kdamond_lock; 789 789 790 790 struct damon_operations ops; 791 + unsigned long addr_unit; 791 792 792 793 struct list_head adaptive_targets; 793 794 struct list_head schemes;
+3
mm/damon/core.c
··· 544 544 ctx->attrs.min_nr_regions = 10; 545 545 ctx->attrs.max_nr_regions = 1000; 546 546 547 + ctx->addr_unit = 1; 548 + 547 549 INIT_LIST_HEAD(&ctx->adaptive_targets); 548 550 INIT_LIST_HEAD(&ctx->schemes); 549 551 ··· 1247 1245 return err; 1248 1246 } 1249 1247 dst->ops = src->ops; 1248 + dst->addr_unit = src->addr_unit; 1250 1249 1251 1250 return 0; 1252 1251 }