[RFC PATCH v2 34/43] mm/damon/lru_sort: Initialise the stub access pattern at boot
Eric Curtin
ericcurtin17 at gmail.com
Mon Nov 30 17:52:06 PST 2026
From: Ryan Roberts <ryan.roberts at arm.com>
damon_lru_sort_stub_pattern sets min_sz_region to PAGE_SIZE in a static
initialiser. PAGE_SIZE is not a constant expression with arm64
boot-time page size selection.
Define the pattern with DEFINE_GLOBAL_PAGE_SIZE_VAR(), which keeps the
plain initialiser for a fixed page size and otherwise fills it in once
the page size is known at boot.
Signed-off-by: Ryan Roberts <ryan.roberts at arm.com>
Signed-off-by: Eric Curtin <eric.curtin at docker.com>
(cherry picked from commit fed214a06106c320f2e46950b5b6672966952196)
---
mm/damon/lru_sort.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index 64e086985eb5..37215e9b956c 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -170,7 +170,7 @@ DEFINE_DAMON_MODULES_DAMOS_STATS_PARAMS(damon_lru_sort_cold_stat,
lru_sort_tried_cold_regions, lru_sorted_cold_regions,
cold_quota_exceeds);
-static struct damos_access_pattern damon_lru_sort_stub_pattern = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR(struct damos_access_pattern, damon_lru_sort_stub_pattern, {
/* Find regions having PAGE_SIZE or larger size */
.min_sz_region = PAGE_SIZE,
.max_sz_region = ULONG_MAX,
@@ -180,7 +180,7 @@ static struct damos_access_pattern damon_lru_sort_stub_pattern = {
/* no matter its age */
.min_age_region = 0,
.max_age_region = UINT_MAX,
-};
+});
static struct damon_ctx *ctx;
static struct damon_target *target;
More information about the linux-arm-kernel
mailing list