* [PATCH] mm/damon: return void from damon_set_schemes()
@ 2022-09-16 15:20 xiakaixu1987
2022-09-16 16:37 ` SeongJae Park
2022-09-18 2:36 ` Muchun Song
0 siblings, 2 replies; 3+ messages in thread
From: xiakaixu1987 @ 2022-09-16 15:20 UTC (permalink / raw)
To: sj, akpm; +Cc: damon, linux-mm, linux-kernel, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
There is no point in returning an int from damon_set_schemes().
It always returns 0 which is meaningless for the caller, so
change it to return void directly.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
include/linux/damon.h | 2 +-
mm/damon/core.c | 5 +----
mm/damon/dbgfs.c | 8 +++-----
mm/damon/lru_sort.c | 4 +---
mm/damon/reclaim.c | 4 +---
5 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 1dda8d0068e5..e7808a84675f 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -541,7 +541,7 @@ unsigned int damon_nr_regions(struct damon_target *t);
struct damon_ctx *damon_new_ctx(void);
void damon_destroy_ctx(struct damon_ctx *ctx);
int damon_set_attrs(struct damon_ctx *ctx, struct damon_attrs *attrs);
-int damon_set_schemes(struct damon_ctx *ctx,
+void damon_set_schemes(struct damon_ctx *ctx,
struct damos **schemes, ssize_t nr_schemes);
int damon_nr_running_ctxs(void);
bool damon_is_registered_ops(enum damon_ops_id id);
diff --git a/mm/damon/core.c b/mm/damon/core.c
index a843673c11cf..9c80c6eb00c2 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -454,10 +454,8 @@ int damon_set_attrs(struct damon_ctx *ctx, struct damon_attrs *attrs)
*
* This function should not be called while the kdamond of the context is
* running.
- *
- * Return: 0 if success, or negative error code otherwise.
*/
-int damon_set_schemes(struct damon_ctx *ctx, struct damos **schemes,
+void damon_set_schemes(struct damon_ctx *ctx, struct damos **schemes,
ssize_t nr_schemes)
{
struct damos *s, *next;
@@ -467,7 +465,6 @@ int damon_set_schemes(struct damon_ctx *ctx, struct damos **schemes,
damon_destroy_scheme(s);
for (i = 0; i < nr_schemes; i++)
damon_add_scheme(ctx, schemes[i]);
- return 0;
}
/**
diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
index c00eba4448d8..6f0ae7d3ae39 100644
--- a/mm/damon/dbgfs.c
+++ b/mm/damon/dbgfs.c
@@ -307,11 +307,9 @@ static ssize_t dbgfs_schemes_write(struct file *file, const char __user *buf,
goto unlock_out;
}
- ret = damon_set_schemes(ctx, schemes, nr_schemes);
- if (!ret) {
- ret = count;
- nr_schemes = 0;
- }
+ damon_set_schemes(ctx, schemes, nr_schemes);
+ ret = count;
+ nr_schemes = 0;
unlock_out:
mutex_unlock(&ctx->kdamond_lock);
diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index abfaf471e3e9..0abb9f8aa9af 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -203,9 +203,7 @@ static int damon_lru_sort_apply_parameters(void)
scheme = damon_lru_sort_new_hot_scheme(hot_thres);
if (!scheme)
return -ENOMEM;
- err = damon_set_schemes(ctx, &scheme, 1);
- if (err)
- return err;
+ damon_set_schemes(ctx, &scheme, 1);
cold_thres = cold_min_age / damon_lru_sort_mon_attrs.aggr_interval;
scheme = damon_lru_sort_new_cold_scheme(cold_thres);
diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c
index 039fa55e0ae9..3d59ab11b7b3 100644
--- a/mm/damon/reclaim.c
+++ b/mm/damon/reclaim.c
@@ -155,9 +155,7 @@ static int damon_reclaim_apply_parameters(void)
scheme = damon_reclaim_new_scheme();
if (!scheme)
return -ENOMEM;
- err = damon_set_schemes(ctx, &scheme, 1);
- if (err)
- return err;
+ damon_set_schemes(ctx, &scheme, 1);
if (monitor_region_start > monitor_region_end)
return -EINVAL;
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/damon: return void from damon_set_schemes()
2022-09-16 15:20 [PATCH] mm/damon: return void from damon_set_schemes() xiakaixu1987
@ 2022-09-16 16:37 ` SeongJae Park
2022-09-18 2:36 ` Muchun Song
1 sibling, 0 replies; 3+ messages in thread
From: SeongJae Park @ 2022-09-16 16:37 UTC (permalink / raw)
To: xiakaixu1987; +Cc: sj, akpm, damon, linux-mm, linux-kernel, Kaixu Xia
On Fri, 16 Sep 2022 23:20:35 +0800 xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> There is no point in returning an int from damon_set_schemes().
> It always returns 0 which is meaningless for the caller, so
> change it to return void directly.
>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/damon: return void from damon_set_schemes()
2022-09-16 15:20 [PATCH] mm/damon: return void from damon_set_schemes() xiakaixu1987
2022-09-16 16:37 ` SeongJae Park
@ 2022-09-18 2:36 ` Muchun Song
1 sibling, 0 replies; 3+ messages in thread
From: Muchun Song @ 2022-09-18 2:36 UTC (permalink / raw)
To: xiakaixu1987; +Cc: sj, Andrew Morton, damon, Linux MM, linux-kernel, Kaixu Xia
> On Sep 16, 2022, at 23:20, xiakaixu1987@gmail.com wrote:
>
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> There is no point in returning an int from damon_set_schemes().
> It always returns 0 which is meaningless for the caller, so
> change it to return void directly.
>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-18 2:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 15:20 [PATCH] mm/damon: return void from damon_set_schemes() xiakaixu1987
2022-09-16 16:37 ` SeongJae Park
2022-09-18 2:36 ` Muchun Song
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.