linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] samples/damon: add parameters for node0 memory usage
@ 2025-06-19  5:03 Yunjeong Mun
  2025-06-19 16:46 ` SeongJae Park
  0 siblings, 1 reply; 4+ messages in thread
From: Yunjeong Mun @ 2025-06-19  5:03 UTC (permalink / raw)
  To: sj; +Cc: damon, linux-mm, linux-kernel, kernel_team, Honggyu Kim

This patch changes 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/

Suggested-by: Honggyu Kim <honggyu.kim@sk.com>
Signed-off-by: Yunjeong Mun <yunjeong.mun@sk.com>
---
 samples/damon/mtier.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/samples/damon/mtier.c b/samples/damon/mtier.c
index 36d2cd933f5a..f3220d6e6739 100644
--- a/samples/damon/mtier.c
+++ b/samples/damon/mtier.c
@@ -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;
-- 
2.34.1



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

* Re: [PATCH] samples/damon: add parameters for node0 memory usage
  2025-06-19  5:03 [PATCH] samples/damon: add parameters for node0 memory usage Yunjeong Mun
@ 2025-06-19 16:46 ` SeongJae Park
  2025-06-20  6:29   ` Yunjeong Mun
  0 siblings, 1 reply; 4+ messages in thread
From: SeongJae Park @ 2025-06-19 16:46 UTC (permalink / raw)
  To: Yunjeong Mun
  Cc: SeongJae Park, damon, linux-mm, linux-kernel, kernel_team,
	Honggyu Kim

On Thu, 19 Jun 2025 14:03:12 +0900 Yunjeong Mun <yunjeong.mun@sk.com> wrote:

> This patch changes 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/

Thank you for this patch.  Please note that this is just a sample code, and
hence there will be no strict user space compatibility support.

> 
> Suggested-by: Honggyu Kim <honggyu.kim@sk.com>
> Signed-off-by: Yunjeong Mun <yunjeong.mun@sk.com>

Reviewed-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

[...]


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

* Re: [PATCH] samples/damon: add parameters for node0 memory usage
  2025-06-19 16:46 ` SeongJae Park
@ 2025-06-20  6:29   ` Yunjeong Mun
  2025-06-20 16:11     ` SeongJae Park
  0 siblings, 1 reply; 4+ messages in thread
From: Yunjeong Mun @ 2025-06-20  6:29 UTC (permalink / raw)
  To: SeongJae Park
  Cc: akpm, damon, linux-mm, linux-kernel, kernel_team, Honggyu Kim

Hi Andrew, please check the patch below. I missed CC'ing you on the previous
email.

On Thu, 19 Jun 2025 09:46:36 -0700 SeongJae Park <sj@kernel.org> wrote:
> On Thu, 19 Jun 2025 14:03:12 +0900 Yunjeong Mun <yunjeong.mun@sk.com> wrote:
> 
> > This patch changes 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/
> 
> Thank you for this patch.  Please note that this is just a sample code, and
> hence there will be no strict user space compatibility support.
> 

Thanks for reviewing. As you said, this mtier sample module needs further 
development for final version, like automatically detecting memory tiers and
adding some useful knobs. May I continue working on the mtier module? 

> > 
> > Suggested-by: Honggyu Kim <honggyu.kim@sk.com>
> > Signed-off-by: Yunjeong Mun <yunjeong.mun@sk.com>
> 
> Reviewed-by: SeongJae Park <sj@kernel.org>
> 
> 
> Thanks,
> SJ
> 
> [...]


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

* Re: [PATCH] samples/damon: add parameters for node0 memory usage
  2025-06-20  6:29   ` Yunjeong Mun
@ 2025-06-20 16:11     ` SeongJae Park
  0 siblings, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2025-06-20 16:11 UTC (permalink / raw)
  To: Yunjeong Mun
  Cc: SeongJae Park, akpm, damon, linux-mm, linux-kernel, kernel_team,
	Honggyu Kim

On Fri, 20 Jun 2025 15:29:46 +0900 Yunjeong Mun <yunjeong.mun@sk.com> wrote:

[...]
> Thanks for reviewing. As you said, this mtier sample module needs further 
> development for final version, like automatically detecting memory tiers and
> adding some useful knobs.

I believe such additional features could be useful sample that could help
people figure out how they could build real products.

> May I continue working on the mtier module? 

Yes, of course.  That would be awesome and helpful.


Thanks,
SJ

[...]


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

end of thread, other threads:[~2025-06-20 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19  5:03 [PATCH] samples/damon: add parameters for node0 memory usage Yunjeong Mun
2025-06-19 16:46 ` SeongJae Park
2025-06-20  6:29   ` Yunjeong Mun
2025-06-20 16:11     ` 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).