All of lore.kernel.org
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: "Xiaolei Wang (Kaihong)" <xiaoleiwangxiaolei@gmail.com>
Cc: SJ Park <sj@kernel.org>,
	akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
	error27@gmail.com, damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	"Liam R. Howlett" <liam@infradead.org>,
	Michal Hocko <mhocko@suse.com>, Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Vlastimil Babka <vbabka@kernel.org>
Subject: Re: [PATCH] mm/damon/core: reject empty access pattern intervals on scheme commit
Date: Tue,  3 Nov 2026 06:53:19 -0800	[thread overview]
Message-ID: <20261103145319.88120-1-sj@kernel.org> (raw)
In-Reply-To: <20261103105418.362459-1-xiaoleiwangxiaolei@gmail.com>

On Tue,  3 Nov 2026 18:54:18 +0800 "Xiaolei Wang (Kaihong)" <xiaoleiwangxiaolei@gmail.com> wrote:

> DAMOS schemes accept access pattern bounds with min > max (e.g.
> min_sz_region > max_sz_region).  No input path validates the bounds:
> damon_new_scheme() stores the pattern as is, and the sysfs ul_range
> stores are plain kstrtoul().
> 
> At runtime __damos_valid_target() evaluates "min <= x <= max" for each
> of the three pattern dimensions.  A reversed interval is an empty set,
> so every region fails the check and the scheme silently never matches
> anything: nr_tried stays zero forever while the kdamond keeps running
> normally.
> 
> With such a reversed interval, damo starts normally (rc=0, kdamond
> state=on), but nr_tried and nr_applied stay zero forever and the target
> RSS does not drop.
> 
> The same holds for the watermarks thresholds, which must be monotonic
> (low <= mid <= high).
> 
> Validate the access pattern and watermarks at the beginning of
> damos_commit(), through which both new schemes (damo start) and online
> updates (damo tune) pass.

The documentation is not explicitly mentioning about the inputs (min > max and
non-monotonic watermarks).  But I was thinking it is not really difficult to
infer this behavior based on the existing document.

If my understanding of the documentation is not wrong, I find no problem at
accepting the inputs and just behave as documented.  It might look silly, but
who knows the users have a creative reason to do that?  As long as it is not
causing a harm, just supporting it is better for both users and code
maintainability, in my humble opinion.

Pleae let me know if I am missing something.


Thanks,
SJ

[...]

  parent reply	other threads:[~2026-11-03 14:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 10:54 [PATCH] mm/damon/core: reject empty access pattern intervals on scheme commit Xiaolei Wang (Kaihong)
2026-11-03 11:29 ` sashiko-bot
2026-11-03 11:44 ` Aveline Noir
2026-11-03 14:53 ` SJ Park [this message]
2026-11-04  1:17   ` Wang Xiaolei
2026-11-05  1:36     ` SJ Park
2026-11-05  1:45       ` Wang Xiaolei

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=20261103145319.88120-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=david@kernel.org \
    --cc=error27@gmail.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=xiaoleiwangxiaolei@gmail.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.