]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
samples/damon/mtier: add parameters for node0 memory usage
authorYunjeong Mun <yunjeong.mun@sk.com>
Fri, 27 Jun 2025 16:33:29 +0000 (09:33 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 13 Jul 2025 23:38:19 +0000 (16:38 -0700)
Change the hard-coded quota goal metric values into sysfs knobs:
`node0_mem_used_bp` and `node0_mem_free_bp`.  These knobs represent the
used and free memory ratio of node0 in basis points (bp, where 1 bp =
0.01%).  As mentioned in [1], this patch is developed under the assumption
that node0 is always the fast-tier in a two-tiers memory setup.

[1] https://lore.kernel.org/linux-mm/20250420194030.75838-8-sj@kernel.org/

Link: https://lkml.kernel.org/r/20250627163329.50997-1-sj@kernel.org
Link: https://patch.msgid.link/20250619050313.1535-1-yunjeong.mun@sk.com
Signed-off-by: Yunjeong Mun <yunjeong.mun@sk.com>
Signed-off-by: SeongJae Park <sj@kernel.org>
Suggested-by: Honggyu Kim <honggyu.kim@sk.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
samples/damon/mtier.c

index c94254b77fc98422d646315f4a6d880971a41fd3..97892ade7f31382fbdd069ab6fdfd0a5030afd95 100644 (file)
@@ -24,6 +24,12 @@ module_param(node1_start_addr, ulong, 0600);
 static unsigned long node1_end_addr __read_mostly;
 module_param(node1_end_addr, ulong, 0600);
 
+static unsigned long node0_mem_used_bp __read_mostly = 9970;
+module_param(node0_mem_used_bp, ulong, 0600);
+
+static unsigned long node0_mem_free_bp __read_mostly = 50;
+module_param(node0_mem_free_bp, ulong, 0600);
+
 static int damon_sample_mtier_enable_store(
                const char *val, const struct kernel_param *kp);
 
@@ -112,7 +118,7 @@ static struct damon_ctx *damon_sample_mtier_build_ctx(bool promote)
        quota_goal = damos_new_quota_goal(
                        promote ? DAMOS_QUOTA_NODE_MEM_USED_BP :
                        DAMOS_QUOTA_NODE_MEM_FREE_BP,
-                       promote ? 9970 : 50);
+                       promote ? node0_mem_used_bp : node0_mem_free_bp);
        if (!quota_goal)
                goto free_out;
        quota_goal->nid = 0;