Re: [PATCH v2 03/11] mm/damon/paddr: support addr_unit for DAMOS_PAGEOUT
From: Quanmin Yan
Date: Mon Aug 25 2025 - 23:17:08 EST
在 2025/8/25 23:12, SeongJae Park 写道:
On Fri, 22 Aug 2025 17:34:11 +0800 Quanmin Yan <yanquanmin1@xxxxxxxxxx> wrote:
From: SeongJae Park <sj@xxxxxxxxxx>
Add support of addr_unit for DAMOS_PAGEOUT action handling from the
DAMOS operation implementation for the physical address space.
[...]
- return applied * PAGE_SIZE;
+ return applied * PAGE_SIZE / addr_unit;
}
Kernel test robot [1] found this can cause __udivdi3 linking issue. Andrew,
could you please add the below attached fixup?
[1] https://lore.kernel.org/oe-kbuild-all/202508241831.EKwdwXZL-lkp@xxxxxxxxx/
Thanks,
SJ
[...]
==== Attachment 0 (0001-mm-damon-paddr-use-do_div-on-i386-for-damon_pa_pageo.patch) ====
From hackermail Thu Jan 1 00:00:00 1970
From: SeongJae Park <sj@xxxxxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: SeongJae Park <sj@xxxxxxxxxx>
Cc: damon@xxxxxxxxxxxxxxx
Cc: kernel-team@xxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: linux-mm@xxxxxxxxx
Date: Mon, 25 Aug 2025 07:41:33 -0700
Subject: [PATCH 1/3] mm/damon/paddr: use do_div() on i386 for damon_pa_pageout()
return value
Otherwise, __udidi3 linking problem happens on certain configs.
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202508241831.EKwdwXZL-lkp@xxxxxxxxx/
Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
---
mm/damon/paddr.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 5fad2f9a99a0..09c87583af6c 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -135,6 +135,18 @@ static bool damon_pa_invalid_damos_folio(struct folio *folio, struct damos *s)
return false;
}
+/* convert physical address to core-layer address */
+static unsigned long damon_pa_core_addr(phys_addr_t pa,
+ unsigned long addr_unit)
+{
+#ifdef __i386__
Can we use the following condition instead?
#if !defined(CONFIG_64BIT) && defined(CONFIG_PHYS_ADDR_T_64BIT)
Thanks,
Quanmin Yan
+ do_div(pa, addr_unit);
+ return pa;
+#else
+ return pa / addr_unit;
+#endif
+}
+
static unsigned long damon_pa_pageout(struct damon_region *r,
unsigned long addr_unit, struct damos *s,
unsigned long *sz_filter_passed)
@@ -190,7 +202,7 @@ static unsigned long damon_pa_pageout(struct damon_region *r,
applied = reclaim_pages(&folio_list);
cond_resched();
s->last_applied = folio;
- return applied * PAGE_SIZE / addr_unit;
+ return damon_pa_core_addr(applied * PAGE_SIZE, addr_unit);
}
static inline unsigned long damon_pa_mark_accessed_or_deactivate(