* [PATCH] mm/damon: support freeze kdamond
@ 2026-04-08 8:06 Lin Ruifeng
2026-04-08 14:07 ` SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: Lin Ruifeng @ 2026-04-08 8:06 UTC (permalink / raw)
To: sj, akpm, chenjun102, tongtiangen; +Cc: damon, linux-mm, linux-kernel
During suspend and resume, the data monitored by kdamond is
no longer meaningful. Meanwhile, since kdamond may involve
I/O operations, it is necessary to freeze it.
Signed-off-by: Lin Ruifeng <linruifeng4@huawei.com>
---
mm/damon/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 3e1890d64d06..5cd1f0aed66b 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -16,6 +16,7 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/string_choices.h>
+#include <linux/freezer.h>
#define CREATE_TRACE_POINTS
#include <trace/events/damon.h>
@@ -2753,6 +2754,7 @@ static int kdamond_fn(void *data)
complete(&ctx->kdamond_started);
kdamond_init_ctx(ctx);
+ set_freezable();
if (ctx->ops.init)
ctx->ops.init(ctx);
@@ -2774,6 +2776,8 @@ static int kdamond_fn(void *data)
unsigned long next_ops_update_sis = ctx->next_ops_update_sis;
unsigned long sample_interval = ctx->attrs.sample_interval;
+ try_to_freeze();
+
if (kdamond_wait_activation(ctx))
break;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/damon: support freeze kdamond
2026-04-08 8:06 [PATCH] mm/damon: support freeze kdamond Lin Ruifeng
@ 2026-04-08 14:07 ` SeongJae Park
0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2026-04-08 14:07 UTC (permalink / raw)
To: Lin Ruifeng
Cc: SeongJae Park, akpm, chenjun102, tongtiangen, damon, linux-mm,
linux-kernel
Hello Lin,
Thank you for sharing this patch.
On Wed, 8 Apr 2026 16:06:52 +0800 Lin Ruifeng <linruifeng4@huawei.com> wrote:
> During suspend and resume, the data monitored by kdamond is
> no longer meaningful. Meanwhile, since kdamond may involve
> I/O operations, it is necessary to freeze it.
I'm not used to PM freezer, and maybe because of that, I'm not fully
understanding the motivation of this patch. Could you please elaborate the
existing problem and how this patch is fixing or improving it?
Thanks,
SJ
>
> Signed-off-by: Lin Ruifeng <linruifeng4@huawei.com>
> ---
> mm/damon/core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 3e1890d64d06..5cd1f0aed66b 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -16,6 +16,7 @@
> #include <linux/slab.h>
> #include <linux/string.h>
> #include <linux/string_choices.h>
> +#include <linux/freezer.h>
>
> #define CREATE_TRACE_POINTS
> #include <trace/events/damon.h>
> @@ -2753,6 +2754,7 @@ static int kdamond_fn(void *data)
>
> complete(&ctx->kdamond_started);
> kdamond_init_ctx(ctx);
> + set_freezable();
>
> if (ctx->ops.init)
> ctx->ops.init(ctx);
> @@ -2774,6 +2776,8 @@ static int kdamond_fn(void *data)
> unsigned long next_ops_update_sis = ctx->next_ops_update_sis;
> unsigned long sample_interval = ctx->attrs.sample_interval;
>
> + try_to_freeze();
> +
> if (kdamond_wait_activation(ctx))
> break;
>
> --
> 2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-08 14:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-08 8:06 [PATCH] mm/damon: support freeze kdamond Lin Ruifeng
2026-04-08 14:07 ` SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox