diff options
author | SeongJae Park <sj@kernel.org> | 2022-03-23 00:48:37 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-23 01:57:12 +0300 |
commit | 436428255d5981e49ff015fc8e398ecf2ba10c24 (patch) | |
tree | d1cf88d248ba7cc1c88b6e4762e917fb24e0ad4e /mm/damon/core.c | |
parent | 8041c87b915b9b7ecb2870f1c529a75aaa2483be (diff) | |
download | linux-436428255d5981e49ff015fc8e398ecf2ba10c24.tar.xz |
mm/damon/core: move damon_set_targets() into dbgfs
damon_set_targets() function is defined in the core for general use cases,
but called from only dbgfs. Also, because the function is for general use
cases, dbgfs does additional handling of pid type target id case. To make
the situation simpler, this commit moves the function into dbgfs and makes
it to do the pid type case handling on its own.
Link: https://lkml.kernel.org/r/20211230100723.2238-4-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/damon/core.c')
-rw-r--r-- | mm/damon/core.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/mm/damon/core.c b/mm/damon/core.c index 1dd153c31c9e..3fef5c667a31 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -246,38 +246,6 @@ void damon_destroy_ctx(struct damon_ctx *ctx) } /** - * damon_set_targets() - Set monitoring targets. - * @ctx: monitoring context - * @ids: array of target ids - * @nr_ids: number of entries in @ids - * - * This function should not be called while the kdamond is running. - * - * Return: 0 on success, negative error code otherwise. - */ -int damon_set_targets(struct damon_ctx *ctx, - unsigned long *ids, ssize_t nr_ids) -{ - ssize_t i; - struct damon_target *t, *next; - - damon_destroy_targets(ctx); - - for (i = 0; i < nr_ids; i++) { - t = damon_new_target(ids[i]); - if (!t) { - /* The caller should do cleanup of the ids itself */ - damon_for_each_target_safe(t, next, ctx) - damon_destroy_target(t); - return -ENOMEM; - } - damon_add_target(ctx, t); - } - - return 0; -} - -/** * damon_set_attrs() - Set attributes for the monitoring. * @ctx: monitoring context * @sample_int: time interval between samplings |