[RFC PATCH mm-next v2 00/12] mm/damon: support ARM32 with LPAE

Quanmin Yan posted 12 patches 1 month, 2 weeks ago
There is a newer version of this series
.../ABI/testing/sysfs-kernel-mm-damon         |   7 ++
Documentation/admin-guide/mm/damon/usage.rst  |  11 +-
Documentation/mm/damon/design.rst             |  16 ++-
include/linux/damon.h                         |   7 +-
mm/damon/core.c                               |  75 +++++++------
mm/damon/paddr.c                              | 106 +++++++++++-------
mm/damon/sysfs.c                              |  41 ++++++-
mm/damon/tests/core-kunit.h                   |  16 +--
mm/damon/tests/vaddr-kunit.h                  |   2 +-
mm/damon/vaddr.c                              |   2 +-
10 files changed, 188 insertions(+), 95 deletions(-)
[RFC PATCH mm-next v2 00/12] mm/damon: support ARM32 with LPAE
Posted by Quanmin Yan 1 month, 2 weeks ago
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.

[1]https://lore.kernel.org/all/20250408075553.959388-1-zuoze1@huawei.com/
[2]https://lore.kernel.org/all/20250416042551.158131-1-sj@kernel.org/

Changes in v2:
- set DAMOS_PAGEOUT, DAMOS_LRU_[DE]PRIO, DAMOS_MIGRATE_{HOT,COLD} and
  DAMOS_STAT stat in core address unit.
- pass ctx->min_region value to replace the original synchronization.
- drop the DAMOS stats type changes, keep them as 'unsigned long' type.
- separate add addr_unit support for DAMON_RECLAIM and LRU_SORT from
  this patch series.

Quanmin Yan (2):
  mm/damon: add damon_ctx->min_region
  mm/damon/core: prevent unnecessary overflow in
    damos_set_effective_quota()

SeongJae Park (10):
  mm/damon/core: add damon_ctx->addr_unit
  mm/damon/paddr: support addr_unit for access monitoring
  mm/damon/paddr: support addr_unit for DAMOS_PAGEOUT
  mm/damon/paddr: support addr_unit for DAMOS_LRU_[DE]PRIO
  mm/damon/paddr: support addr_unit for MIGRATE_{HOT,COLD}
  mm/damon/paddr: support addr_unit for DAMOS_STAT
  mm/damon/sysfs: implement addr_unit file under context dir
  Docs/mm/damon/design: document 'address unit' parameter
  Docs/admin-guide/mm/damon/usage: document addr_unit file
  Docs/ABI/damon: document addr_unit file

 .../ABI/testing/sysfs-kernel-mm-damon         |   7 ++
 Documentation/admin-guide/mm/damon/usage.rst  |  11 +-
 Documentation/mm/damon/design.rst             |  16 ++-
 include/linux/damon.h                         |   7 +-
 mm/damon/core.c                               |  75 +++++++------
 mm/damon/paddr.c                              | 106 +++++++++++-------
 mm/damon/sysfs.c                              |  41 ++++++-
 mm/damon/tests/core-kunit.h                   |  16 +--
 mm/damon/tests/vaddr-kunit.h                  |   2 +-
 mm/damon/vaddr.c                              |   2 +-
 10 files changed, 188 insertions(+), 95 deletions(-)

-- 
2.43.0
Re: [RFC PATCH mm-next v2 00/12] mm/damon: support ARM32 with LPAE
Posted by SeongJae Park 1 month, 2 weeks ago
On Wed, 20 Aug 2025 16:06:10 +0800 Quanmin Yan <yanquanmin1@huawei.com> wrote:

> 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.
> 
> [1]https://lore.kernel.org/all/20250408075553.959388-1-zuoze1@huawei.com/
> [2]https://lore.kernel.org/all/20250416042551.158131-1-sj@kernel.org/
> 
> Changes in v2:

It would be nice if you can also add the link to the previous version, e.g.,
like the revisions history of
https://lore.kernel.org/20250819193404.46680-1-sj@kernel.org

> - set DAMOS_PAGEOUT, DAMOS_LRU_[DE]PRIO, DAMOS_MIGRATE_{HOT,COLD} and
>   DAMOS_STAT stat in core address unit.
> - pass ctx->min_region value to replace the original synchronization.
> - drop the DAMOS stats type changes, keep them as 'unsigned long' type.
> - separate add addr_unit support for DAMON_RECLAIM and LRU_SORT from
>   this patch series.

Thank you for continuing this work!

> 
> Quanmin Yan (2):
>   mm/damon: add damon_ctx->min_region
>   mm/damon/core: prevent unnecessary overflow in
>     damos_set_effective_quota()

I left a few comments.  In essense, let's rename min_region to min_sz_region,
and separate the last fix from this series.

Other than above, looks good overall.  I think you can drop RFC tag from the
next version.


Thanks,
SJ

[...]
Re: [RFC PATCH mm-next v2 00/12] mm/damon: support ARM32 with LPAE
Posted by Quanmin Yan 1 month, 1 week ago
Hi SJ,

在 2025/8/21 6:23, SeongJae Park 写道:
> On Wed, 20 Aug 2025 16:06:10 +0800 Quanmin Yan <yanquanmin1@huawei.com> wrote:
>
>> 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.
>>
>> [1]https://lore.kernel.org/all/20250408075553.959388-1-zuoze1@huawei.com/
>> [2]https://lore.kernel.org/all/20250416042551.158131-1-sj@kernel.org/
>>
>> Changes in v2:
> It would be nice if you can also add the link to the previous version, e.g.,
> like the revisions history of
> https://lore.kernel.org/20250819193404.46680-1-sj@kernel.org
>
>> - set DAMOS_PAGEOUT, DAMOS_LRU_[DE]PRIO, DAMOS_MIGRATE_{HOT,COLD} and
>>    DAMOS_STAT stat in core address unit.
>> - pass ctx->min_region value to replace the original synchronization.
>> - drop the DAMOS stats type changes, keep them as 'unsigned long' type.
>> - separate add addr_unit support for DAMON_RECLAIM and LRU_SORT from
>>    this patch series.
> Thank you for continuing this work!
>
>> Quanmin Yan (2):
>>    mm/damon: add damon_ctx->min_region
>>    mm/damon/core: prevent unnecessary overflow in
>>      damos_set_effective_quota()
> I left a few comments.  In essense, let's rename min_region to min_sz_region,
> and separate the last fix from this series.
>
> Other than above, looks good overall.  I think you can drop RFC tag from the
> next version.
>
>
> Thanks,
> SJ
>
Thank you for your guidance on my work. I have published a new patch series,
please review it at [1].

[1] https://lore.kernel.org/all/20250821105159.2503894-1-yanquanmin1@huawei.com/


Best regards,
Quanmin Yan