[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220429160606.127307-3-sj@kernel.org>
Date: Fri, 29 Apr 2022 16:05:54 +0000
From: sj@...nel.org
To: akpm@...ux-foundation.org
Cc: linux-damon@...zon.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, SeongJae Park <sj@...nel.org>
Subject: [PATCH 02/14] mm/damon/core: finish kdamond as soon as any callback returns an error
From: SeongJae Park <sj@...nel.org>
When 'after_sampling()' or 'after_aggregation()' DAMON callbacks return
an error, kdamond continues the remaining loop once. It makes no much
sense to run the remaining part while something wrong already happened.
The context might be corrupted or having invalid data. This commit
therefore makes kdamond skips the remaining works and immediately finish
in the cases.
Signed-off-by: SeongJae Park <sj@...nel.org>
---
mm/damon/core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index e28fbc3a1969..18c08e90563e 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1141,8 +1141,10 @@ static int kdamond_fn(void *data)
if (ctx->ops.prepare_access_checks)
ctx->ops.prepare_access_checks(ctx);
if (ctx->callback.after_sampling &&
- ctx->callback.after_sampling(ctx))
+ ctx->callback.after_sampling(ctx)) {
done = true;
+ continue;
+ }
kdamond_usleep(ctx->sample_interval);
@@ -1154,8 +1156,10 @@ static int kdamond_fn(void *data)
max_nr_accesses / 10,
sz_limit);
if (ctx->callback.after_aggregation &&
- ctx->callback.after_aggregation(ctx))
+ ctx->callback.after_aggregation(ctx)) {
done = true;
+ continue;
+ }
kdamond_apply_schemes(ctx);
kdamond_reset_aggregated(ctx);
kdamond_split_regions(ctx);
--
2.25.1
Powered by blists - more mailing lists