lkml.org 
[lkml]   [2022]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH 08/11] mm/damon/sysfs-schemes: implement scheme filters
Date
On Thu, 24 Nov 2022 21:21:11 +0000 SeongJae Park <sj@kernel.org> wrote:

> Implement scheme filters functionality of DAMON sysfs interface by
> making the code reads the values of files under the filter directories
> and pass that to DAMON using DAMON kernel API.
>
> Signed-off-by: SeongJae Park <sj@kernel.org>
> ---
> mm/damon/sysfs-schemes.c | 85 +++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 84 insertions(+), 1 deletion(-)
>
> diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
> index 7f2bab617156..6f014b328e6f 100644
> --- a/mm/damon/sysfs-schemes.c
> +++ b/mm/damon/sysfs-schemes.c
[...]
> +static int damon_sysfs_set_scheme_filters(struct damos *scheme,
> + struct damon_sysfs_scheme_filters *sysfs_filters)
> +{
> + int i;
> + struct damos_filter *filter, *next;
> +
> + damos_for_each_filter_safe(filter, next, scheme)
> + damos_destroy_filter(filter);
> +
> + for (i = 0; i < sysfs_filters->nr; i++) {
> + struct damon_sysfs_scheme_filter *sysfs_filter =
> + sysfs_filters->filters_arr[i];
> + struct damos_filter *filter =
> + damos_new_filter(sysfs_filter->type,
> + sysfs_filter->matching);
> + int err;
> +
> + if (!filter)
> + return -ENOMEM;
> + if (filter->type == DAMOS_FILTER_TYPE_MEMCG) {
> + err = damon_sysfs_memcg_path_to_id(
> + sysfs_filter->memcg_path,
> + &filter->memcg_id);
> + if (err)
> + return err;
> + }

Newly created filter should be added to the scheme, but this patch is missing
the code. Will add that in the next version of this patch.

> + }
> + return 0;
> +}
> +

\
 
 \ /
  Last update: 2022-11-27 20:52    [W:1.052 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site