Skip to content

Commit

Permalink
mm/damon/core: skip apply schemes if empty
Browse files Browse the repository at this point in the history
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.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Huaisheng Ye <[email protected]>
Reviewed-by: SeongJae Park <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
yehs1 authored and akpm00 committed Feb 3, 2023
1 parent 98001fd commit 64517d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/damon/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,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)
Expand Down

0 comments on commit 64517d6

Please sign in to comment.