Re: [RFC PATCH v2 01/10] mm/damon/core: introduce damon_ctx->paused
From: SeongJae Park
Date: Thu Mar 19 2026 - 02:30:10 EST
On Wed, 18 Mar 2026 22:21:44 -0700 SeongJae Park <sj@xxxxxxxxxx> wrote:
> DAMON supports only start and stop of the execution. When it is
> stopped, its internal data that it self-trained goes away. It will be
> useful if the execution can be paused and resumed with the previous
> self-trained data.
>
> Introduce per-context API parameter, 'paused', for the purpose. The
> parameter can be set and unset while DAMON is running and paused, using
> the online parameters commit helper functions (damon_commit_ctx() and
> damon_call()). Once 'paused' is set, the kdamond_fn() main loop does
> only limited works with sampling interval sleep during the works. The
> limited works include the handling of the online parameters update, so
> that users can unset the 'pause' and resume the execution when they
> want. It also keep checking DAMON stop conditions and handling of it,
> so that DAMON can be stopped while paused if needed.
>
> Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
> ---
> include/linux/damon.h | 2 ++
> mm/damon/core.c | 9 +++++++++
> 2 files changed, 11 insertions(+)
>
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index 3a441fbca170d..421e51eff3bd2 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -811,6 +811,8 @@ struct damon_ctx {
> * intervals tuning
> */
> unsigned long next_intervals_tune_sis;
> + /* pause kdamond main loop */
> + bool pause;
This field will be directly set by an API caller. But this diff is defining
this field in the private fields section. I will change this to be defined in
the public fields section, and add the kernel-doc comment, in the next version.
Thanks,
SJ
[...]