diff options
| author | SJ Park <sj@kernel.org> | 2026-07-06 07:06:18 -0700 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-07-30 19:48:08 -0700 |
| commit | 6202703c64dcfa361a0113b560e2d29d06fd9bdd (patch) | |
| tree | 6904d3d17f3f3b300a0f6ae42c5d91c81ca61f19 | |
| parent | 358582eddde45ae373c07313738fe6eaf20bbbc9 (diff) | |
| download | linux-next-6202703c64dcfa361a0113b560e2d29d06fd9bdd.tar.gz linux-next-6202703c64dcfa361a0113b560e2d29d06fd9bdd.zip | |
mm/damon/core: make damon_stop() never fail
damon_stop() has no reason to fail. It returns an error code only for
possible future changes that can make it fail. Such a change has not been
made yet, and this only makes the error handling complicated and
confusing. Ensure it returns no error.
Link: https://lore.kernel.org/20260706140628.87414-4-sj@kernel.org
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
| -rw-r--r-- | mm/damon/core.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/mm/damon/core.c b/mm/damon/core.c index d89a7f2faf35..84e400aa4e82 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1926,10 +1926,8 @@ int damon_start(struct damon_ctx **ctxs, int nr_ctxs, bool exclusive) /* * __damon_stop() - Stops monitoring of a given context. * @ctx: monitoring context - * - * Return: 0 on success, negative error code otherwise. */ -static int __damon_stop(struct damon_ctx *ctx) +static void __damon_stop(struct damon_ctx *ctx) { struct task_struct *tsk; @@ -1939,31 +1937,24 @@ static int __damon_stop(struct damon_ctx *ctx) get_task_struct(tsk); mutex_unlock(&ctx->kdamond_lock); kthread_stop_put(tsk); - return 0; + return; } mutex_unlock(&ctx->kdamond_lock); - - return -EPERM; } /** * damon_stop() - Stops the monitorings for a given group of contexts. * @ctxs: an array of the pointers for contexts to stop monitoring * @nr_ctxs: size of @ctxs - * - * Return: 0 on success, negative error code otherwise. */ int damon_stop(struct damon_ctx **ctxs, int nr_ctxs) { - int i, err = 0; + int i; - for (i = 0; i < nr_ctxs; i++) { + for (i = 0; i < nr_ctxs; i++) /* nr_running_ctxs is decremented in kdamond_fn */ - err = __damon_stop(ctxs[i]); - if (err) - break; - } - return err; + __damon_stop(ctxs[i]); + return 0; } /** |
