linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm/damon: fixes for address alignment issues in DAMON_LRU_SORT and DAMON_RECLAIM
@ 2025-10-20 13:01 Quanmin Yan
  2025-10-20 13:01 ` [PATCH v2 1/2] mm/damon: add a min_sz_region parameter to damon_set_region_biggest_system_ram_default() Quanmin Yan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Quanmin Yan @ 2025-10-20 13:01 UTC (permalink / raw)
  To: sj
  Cc: akpm, damon, linux-kernel, linux-mm, yanquanmin1, wangkefeng.wang,
	zuoze1

In DAMON_LRU_SORT and DAMON_RECLAIM, damon_set_regions() will apply
DAMON_MIN_REGION as the core address alignment, and the monitoring
target address ranges would be aligned on DAMON_MIN_REGION * addr_unit.
When users 1) set addr_unit to a value larger than 1, and 2) set the
monitoring target address range as not aligned on DAMON_MIN_REGION *
addr_unit, it will cause DAMON_LRU_SORT and DAMON_RECLAIM to operate
on unexpectedly large physical address ranges.

For example, if the user sets the monitoring target address range to
[4, 8) and addr_unit as 1024, the aimed monitoring target address range
is [4 KiB, 8 KiB). Assuming DAMON_MIN_REGION is 4096, so resulting
target address range will be [0, 4096) in the DAMON core layer address
system, and [0, 4 MiB) in the physical address space, which is an
unexpected range.

To fix the issue, add a min_sz_region parameter to
damon_set_region_biggest_system_ram_default() and use it when calling
damon_set_regions(), replacing the direct use of DAMON_MIN_REGION.

Changes from v1
(https://lore.kernel.org/all/20251016104717.2194909-1-yanquanmin1@huawei.com/)
- Added more issue description in the commit message.
- Split the original fix patch into two separate patches.

Quanmin Yan (2):
  mm/damon: add a min_sz_region parameter to
    damon_set_region_biggest_system_ram_default()
  mm/damon/reclaim: use min_sz_region for core address alignment when
    setting regions

 include/linux/damon.h | 3 ++-
 mm/damon/core.c       | 6 ++++--
 mm/damon/lru_sort.c   | 3 ++-
 mm/damon/reclaim.c    | 3 ++-
 mm/damon/stat.c       | 3 ++-
 5 files changed, 12 insertions(+), 6 deletions(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-10-20 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 13:01 [PATCH v2 0/2] mm/damon: fixes for address alignment issues in DAMON_LRU_SORT and DAMON_RECLAIM Quanmin Yan
2025-10-20 13:01 ` [PATCH v2 1/2] mm/damon: add a min_sz_region parameter to damon_set_region_biggest_system_ram_default() Quanmin Yan
2025-10-20 15:06   ` SeongJae Park
2025-10-20 13:01 ` [PATCH v2 2/2] mm/damon/reclaim: use min_sz_region for core address alignment when setting regions Quanmin Yan
2025-10-20 15:07   ` SeongJae Park
2025-10-20 15:06 ` [PATCH v2 0/2] mm/damon: fixes for address alignment issues in DAMON_LRU_SORT and DAMON_RECLAIM SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).