* [PATCH] mm/damon/core: skip apply schemes if empty
@ 2023-01-16 6:23 Huaisheng Ye
2023-01-16 17:31 ` SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: Huaisheng Ye @ 2023-01-16 6:23 UTC (permalink / raw)
To: sj; +Cc: akpm, damon, linux-mm, linux-kernel, Huaisheng Ye
Sometimes there is no scheme in damon's context, for example
just use damo record to monitor workload's data access pattern.
If current damon context doesn't have any scheme in the list,
kdamond has no need to iterate over list of all targets and regions
but do nothing.
So, skip apply schemes when ctx->schemes is empty.
Signed-off-by: Huaisheng Ye <huaisheng.ye@intel.com>
---
mm/damon/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index ceec75b88ef9..f338691e4591 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1230,7 +1230,8 @@ static int kdamond_fn(void *data)
if (ctx->callback.after_aggregation &&
ctx->callback.after_aggregation(ctx))
break;
- kdamond_apply_schemes(ctx);
+ if (!list_empty(&ctx->schemes))
+ kdamond_apply_schemes(ctx);
kdamond_reset_aggregated(ctx);
kdamond_split_regions(ctx);
if (ctx->ops.reset_aggregated)
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/damon/core: skip apply schemes if empty
2023-01-16 6:23 [PATCH] mm/damon/core: skip apply schemes if empty Huaisheng Ye
@ 2023-01-16 17:31 ` SeongJae Park
0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2023-01-16 17:31 UTC (permalink / raw)
To: Huaisheng Ye; +Cc: sj, akpm, damon, linux-mm, linux-kernel
Hi Huaisheng,
On Mon, 16 Jan 2023 14:23:47 +0800 Huaisheng Ye <huaisheng.ye@intel.com> wrote:
> Sometimes there is no scheme in damon's context, for example
> just use damo record to monitor workload's data access pattern.
>
> If current damon context doesn't have any scheme in the list,
> kdamond has no need to iterate over list of all targets and regions
> but do nothing.
>
> So, skip apply schemes when ctx->schemes is empty.
Good finding, thanks!
>
> Signed-off-by: Huaisheng Ye <huaisheng.ye@intel.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
> ---
> mm/damon/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index ceec75b88ef9..f338691e4591 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1230,7 +1230,8 @@ static int kdamond_fn(void *data)
> if (ctx->callback.after_aggregation &&
> ctx->callback.after_aggregation(ctx))
> break;
> - kdamond_apply_schemes(ctx);
> + if (!list_empty(&ctx->schemes))
> + kdamond_apply_schemes(ctx);
> kdamond_reset_aggregated(ctx);
> kdamond_split_regions(ctx);
> if (ctx->ops.reset_aggregated)
> --
> 2.31.1
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-16 17:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 6:23 [PATCH] mm/damon/core: skip apply schemes if empty Huaisheng Ye
2023-01-16 17:31 ` SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox