[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211118115113.20234-1-sj@kernel.org>
Date: Thu, 18 Nov 2021 11:51:13 +0000
From: SeongJae Park <sj@...nel.org>
To: Xin Hao <xhao@...ux.alibaba.com>
Cc: sjpark@...zon.de, sj@...nel.org, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V1] mm/damon/schemes: Add the validity judgment of thresholds
Hi Xin,
Thank you for this patch.
>From next time, please send patches for DAMON to sj@...nel.org instead of
sjpark@...zon.de.
On Thu, 18 Nov 2021 12:16:02 +0800 Xin Hao <xhao@...ux.alibaba.com> wrote:
> In dbgfs "schemes" interface, i do some test like this:
> # cd /sys/kernel/debug/damon
> # echo "2 1 2 1 10 1 3 10 1 1 1 1 1 1 1 1 2 3" > schemes
> # cat schemes
> # 2 1 2 1 10 1 3 10 1 1 1 1 1 1 1 1 2 3 0 0
>
> There have some unreasonable places, i set the valules of these variables
> "<min_sz, max_sz> <min_nr_a, max_nr_a>, <min_age, max_age>, <wmarks.high,
> wmarks.mid, wmarks.low>" as "<2, 1>, <2, 1>, <10, 1>, <1, 2, 3>.
>
> So there add a validity judgment for these threshold values.
>
> Signed-off-by: Xin Hao <xhao@...ux.alibaba.com>
> ---
> mm/damon/dbgfs.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
> index befb27a29aab..a4c94d563d3d 100644
> --- a/mm/damon/dbgfs.c
> +++ b/mm/damon/dbgfs.c
> @@ -215,6 +215,17 @@ static struct damos **str_to_schemes(const char *str, ssize_t len,
> goto fail;
> }
>
> + if (min_sz > max_sz || min_nr_a > max_nr_a || min_age > max_age) {
> + pr_err("mininum > maxinum\n");
I think this error message is not really needed.
> + goto fail;
> + }
> +
> + if (wmarks.high < wmarks.mid || wmarks.high < wmarks.low ||
> + wmarks.mid < wmarks.low) {
> + pr_err("wrong wmarks\n");
Ditto.
Thanks,
SJ
> + goto fail;
> + }
> +
> pos += parsed;
> scheme = damon_new_scheme(min_sz, max_sz, min_nr_a, max_nr_a,
> min_age, max_age, action, "a, &wmarks);
> --
> 2.31.0
Powered by blists - more mailing lists