Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kunwu Chan <kunwu.chan@gmail.com>
To: SJ Park <sj@kernel.org>
Cc: Kunwu Chan <kunwu.chan@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	damon@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH 05/12] mm/damon/sysfs: remove probes number validation
Date: Wed,  2 Sep 2026 22:07:13 +0800	[thread overview]
Message-ID: <20260902140714.4023700-1-kunwu.chan@linux.dev> (raw)
In-Reply-To: <20260902054747.99370-6-sj@kernel.org>

On Tue,  1 Sep 2026 22:47:38 -0700 SJ Park <sj@kernel.org> wrote:

> DAMON sysfs interface is disallowing >DAMON_MAX_PROBES nr_probes input,
> since DAMON_MAX_PROBES is the upper limit of probes per DAMON context.
> The core layer is validating the upper limit again, though.  It is
> preferred to let DAMON API callers such as sysfs interface to set
> parameters in flexible ways, and do parameters validation in the core
> layer.  Drop the duplicated validation in the sysfs interface.
> 
> Signed-off-by: SJ Park <sj@kernel.org>
> ---
>  mm/damon/sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
> index 7ec14f48d157a..b576e97cbfdb8 100644
> --- a/mm/damon/sysfs.c
> +++ b/mm/damon/sysfs.c
> @@ -1479,7 +1479,7 @@ static ssize_t nr_probes_store(struct kobject *kobj,
>  
>  	if (err)
>  		return err;
> -	if (nr < 0 || nr > DAMON_MAX_PROBES)
> +	if (nr < 0)

Hi SJ,

Thanks for the cleanup.

I was wondering whether DAMON_MAX_PROBES is purely a core invariant
or also an interface constraint.

With this change, sysfs allows nr_probes larger than
DAMON_MAX_PROBES and damon_sysfs_probes_add_dirs() will start creating
probe objects before the configuration is later rejected by
damon_valid_probe_params().

Since nr_probes directly controls the number of sysfs objects created,
do we still want to keep an early check here?

I agree that the core validation is required for non-sysfs callers,
but I am not sure whether this particular limit should be duplicated
at the sysfs layer.

Thanks,
Kunwu


>  		return -EINVAL;
>  
>  	probes = container_of(kobj, struct damon_sysfs_probes, kobj);
> -- 
> 2.47.3
> 

Sent using hkml (https://github.com/sjp38/hackermail)


  reply	other threads:[~2026-09-02 14:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  5:47 [PATCH 00/12] mm/damon: cleanup code, add test cases, and update guidances in docs SJ Park
2026-09-02  5:47 ` [PATCH 01/12] mm/damon/core: use damon_nr_samples_per_aggr() for max merge threshold SJ Park
2026-09-03  2:00   ` Kunwu Chan
2026-09-02  5:47 ` [PATCH 02/12] mm/damon/core: remove debug messages SJ Park
2026-09-02  6:14   ` SJ Park
2026-09-02  5:47 ` [PATCH 03/12] mm/damon/vaddr: remove a debug message SJ Park
2026-09-03  2:24   ` Kunwu Chan
2026-09-02  5:47 ` [PATCH 04/12] mm/damon/core: validate number of probes in valid_probe_params() SJ Park
2026-09-02 15:32   ` Kunwu Chan
2026-09-02  5:47 ` [PATCH 05/12] mm/damon/sysfs: remove probes number validation SJ Park
2026-09-02 14:07   ` Kunwu Chan [this message]
2026-09-02 14:37     ` SJ Park
2026-09-02 15:33       ` Kunwu Chan
2026-09-02  5:47 ` [PATCH 06/12] mm/damon/tests/core-kunit: extend set_regions() test for error case SJ Park
2026-09-02  5:47 ` [PATCH 07/12] mm/damon/tests/core-kunit: test <=0 size damon_set_regions() inputs SJ Park
2026-09-02  5:47 ` [PATCH 08/12] mm/damon/tests/core-kunit: test overlapping ranges for set_regions() SJ Park
2026-09-03  3:04   ` Kunwu Chan
2026-09-02  5:47 ` [PATCH 09/12] mm/damon/tests/core-kunit: test damon_nr_samples_per_aggr() SJ Park
2026-09-02 15:08   ` Kunwu Chan
2026-09-02 15:19     ` SJ Park
2026-09-02 15:49       ` Kunwu Chan
2026-09-03  0:22         ` SJ Park
2026-09-02  5:47 ` [PATCH 10/12] selftests/damon/sysfs.sh: test hugepage_mem_bp quota goal SJ Park
2026-09-03  3:06   ` Kunwu Chan
2026-09-02  5:47 ` [PATCH 11/12] Docs/mm/damon/maintainer-profile: update AI review for Sashiko replies SJ Park
2026-09-02  5:47 ` [PATCH 12/12] Docs/ABI/damon: recommend subsystem doc instead of admin-guide SJ Park
2026-09-03  3:09   ` Kunwu Chan
2026-09-02  6:16 ` [PATCH 00/12] mm/damon: cleanup code, add test cases, and update guidances in docs SJ Park
2026-09-02 22:42 ` Andrew Morton

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=20260902140714.4023700-1-kunwu.chan@linux.dev \
    --to=kunwu.chan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=kunwu.chan@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sj@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox