* [PATCH] mm/damon: remove return value from before_terminate callback
@ 2021-10-29 0:50 Changbin Du
2021-10-29 7:22 ` SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: Changbin Du @ 2021-10-29 0:50 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, linux-mm, linux-kernel, Changbin Du
Since the return value of 'before_terminate' callback is never used,
we make it have no return value.
Signed-off-by: Changbin Du <changbin.du@gmail.com>
---
include/linux/damon.h | 2 +-
mm/damon/dbgfs.c | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 50c6eb0dee1f..041966786270 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -322,7 +322,7 @@ struct damon_callback {
int (*before_start)(struct damon_ctx *context);
int (*after_sampling)(struct damon_ctx *context);
int (*after_aggregation)(struct damon_ctx *context);
- int (*before_terminate)(struct damon_ctx *context);
+ void (*before_terminate)(struct damon_ctx *context);
};
/**
diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
index befb27a29aab..eccc14b34901 100644
--- a/mm/damon/dbgfs.c
+++ b/mm/damon/dbgfs.c
@@ -645,18 +645,17 @@ static void dbgfs_fill_ctx_dir(struct dentry *dir, struct damon_ctx *ctx)
debugfs_create_file(file_names[i], 0600, dir, ctx, fops[i]);
}
-static int dbgfs_before_terminate(struct damon_ctx *ctx)
+static void dbgfs_before_terminate(struct damon_ctx *ctx)
{
struct damon_target *t, *next;
if (!targetid_is_pid(ctx))
- return 0;
+ return;
damon_for_each_target_safe(t, next, ctx) {
put_pid((struct pid *)t->id);
damon_destroy_target(t);
}
- return 0;
}
static struct damon_ctx *dbgfs_new_ctx(void)
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/damon: remove return value from before_terminate callback
2021-10-29 0:50 [PATCH] mm/damon: remove return value from before_terminate callback Changbin Du
@ 2021-10-29 7:22 ` SeongJae Park
0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2021-10-29 7:22 UTC (permalink / raw)
To: Changbin Du; +Cc: Andrew Morton, SeongJae Park, linux-mm, linux-kernel
On Fri, 29 Oct 2021 08:50:23 +0800 Changbin Du <changbin.du@gmail.com> wrote:
> Since the return value of 'before_terminate' callback is never used,
> we make it have no return value.
>
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
Thank you for this patch!
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
> ---
> include/linux/damon.h | 2 +-
> mm/damon/dbgfs.c | 5 ++---
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index 50c6eb0dee1f..041966786270 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -322,7 +322,7 @@ struct damon_callback {
> int (*before_start)(struct damon_ctx *context);
> int (*after_sampling)(struct damon_ctx *context);
> int (*after_aggregation)(struct damon_ctx *context);
> - int (*before_terminate)(struct damon_ctx *context);
> + void (*before_terminate)(struct damon_ctx *context);
> };
>
> /**
> diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
> index befb27a29aab..eccc14b34901 100644
> --- a/mm/damon/dbgfs.c
> +++ b/mm/damon/dbgfs.c
> @@ -645,18 +645,17 @@ static void dbgfs_fill_ctx_dir(struct dentry *dir, struct damon_ctx *ctx)
> debugfs_create_file(file_names[i], 0600, dir, ctx, fops[i]);
> }
>
> -static int dbgfs_before_terminate(struct damon_ctx *ctx)
> +static void dbgfs_before_terminate(struct damon_ctx *ctx)
> {
> struct damon_target *t, *next;
>
> if (!targetid_is_pid(ctx))
> - return 0;
> + return;
>
> damon_for_each_target_safe(t, next, ctx) {
> put_pid((struct pid *)t->id);
> damon_destroy_target(t);
> }
> - return 0;
> }
>
> static struct damon_ctx *dbgfs_new_ctx(void)
> --
> 2.32.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-29 7:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 0:50 [PATCH] mm/damon: remove return value from before_terminate callback Changbin Du
2021-10-29 7:22 ` SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).