All of lore.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Xin Hao <xhao@linux.alibaba.com>
Cc: sjpark@amazon.de, sj@kernel.org, akpm@linux-foundation.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V1] mm/damon/schemes: Add the validity judgment of thresholds
Date: Thu, 18 Nov 2021 11:51:13 +0000	[thread overview]
Message-ID: <20211118115113.20234-1-sj@kernel.org> (raw)
In-Reply-To: <2ebc35fcafe61f9dfbb61cfb5dd3fa2c567c37fa.1637208947.git.xhao@linux.alibaba.com>

Hi Xin,


Thank you for this patch.

From next time, please send patches for DAMON to sj@kernel.org instead of
sjpark@amazon.de.

On Thu, 18 Nov 2021 12:16:02 +0800 Xin Hao <xhao@linux.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@linux.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, &quota, &wmarks);
> -- 
> 2.31.0


  reply	other threads:[~2021-11-18 11:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18  4:16 [PATCH V1] mm/damon/schemes: Add the validity judgment of thresholds Xin Hao
2021-11-18 11:51 ` SeongJae Park [this message]
2021-11-18 12:00   ` Xin Hao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211118115113.20234-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sjpark@amazon.de \
    --cc=xhao@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.