linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Honggyu Kim <honggyu.kim@sk.com>
Cc: SeongJae Park <sj@kernel.org>,
	kernel_team@skhynix.com, damon@lists.linux.dev,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, Yunjeong Mun <yunjeong.mun@sk.com>
Subject: Re: [PATCH 1/3] mm/damon: do not allow creating zero size region
Date: Thu, 26 Jun 2025 08:27:13 -0700	[thread overview]
Message-ID: <20250626152713.333339-1-sj@kernel.org> (raw)
In-Reply-To: <697aed09-80ff-41d4-b1cb-321c9fd9ff23@sk.com>

On Thu, 26 Jun 2025 07:24:14 +0900 Honggyu Kim <honggyu.kim@sk.com> wrote:

> Hi SeongJae,
> 
> Sorry for the late response.

No worry!

> On 6/24/2025 3:03 AM, SeongJae Park wrote:
> > On Mon, 23 Jun 2025 11:58:53 +0900 Honggyu Kim <honggyu.kim@sk.com> wrote:
[...]
> > I mean, something like below.
> > 
> > @@ -1449,6 +1449,7 @@ static unsigned long damon_get_intervals_score(struct damon_ctx *c)
> >                  }
> >          }
> >          target_access_events = max_access_events * goal_bp / 10000;
> > +       target_access_events = target_access_events ? : 1;
> >          return access_events * 10000 / target_access_events;
> >   }
> 
> I actually didn't mean the code, but just wondered if setting 
> "target_access_events" to 1 makes sense in this context.
> 
> I now think that it doesn't make any difference because applying DAMOS actions
> to zero size regions as it's just no-ops.  So I can take your change.

Thank you for clarifying, looking forward to your fix! :)

[...]
> > I still prefer fixing the found bug on the spot.  I don't think having zero or
> > negative size regions is really somewhat we always prohibit.
> 
> I can split "target_access_events" change patch from this regardless of this
> with "Fixes" tag.
> 
> But I don't get why you think zero size region is acceptable.  Do you see any 
> benefits or have special reasons allowing zero size regions?

In short, I don't anticipate special benefits of allowing zero size region.
But that's smae to this change.

I even have small concern about this change.

This change might make people assume any damon_region would have non-zero
positive size.  I think that's wrong assumption.  Any DAMON core and API caller
code can set the start and the end addresses with arbitrary values.

I think making the assumption true could be beneficial since it will help
writing code with less corner cases.  But to make the assumption true, we
should first check if any existing code is violating it, and if any existing
code that written with current assumption (region size can be zero) can be
broken.  After that, we should also prevent future code violating it.

And if the assumption becomes truth, we get one more rule.  I, at least, prefer
having as less rules as possible.  My taste may be weird, but this is my humble
feeling and opinion.


Thanks,
SJ

[...]


  reply	other threads:[~2025-06-26 15:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-22 12:09 [PATCH 0/3] mm/damon: Enhance damon and its samples Honggyu Kim
2025-06-22 12:09 ` [PATCH 1/3] mm/damon: do not allow creating zero size region Honggyu Kim
2025-06-22 16:04   ` SeongJae Park
2025-06-23  2:58     ` Honggyu Kim
2025-06-23 18:03       ` SeongJae Park
2025-06-25 22:24         ` Honggyu Kim
2025-06-26 15:27           ` SeongJae Park [this message]
2025-06-27 11:29             ` Honggyu Kim
2025-06-22 12:09 ` [PATCH 2/3] samples/damon: change enable parameters to enabled Honggyu Kim
2025-06-22 16:14   ` SeongJae Park
2025-06-23  3:04     ` Honggyu Kim
2025-06-22 12:09 ` [PATCH 3/3] samples/damon: fix bugs for damon sample for start failures Honggyu Kim
2025-06-22 16:29   ` SeongJae Park
2025-06-23  3:16     ` Honggyu Kim
2025-06-23 18:11       ` SeongJae Park
2025-06-25 22:27         ` Honggyu Kim
2025-06-26 15:28           ` SeongJae Park

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=20250626152713.333339-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=honggyu.kim@sk.com \
    --cc=kernel_team@skhynix.com \
    --cc=linux-mm@kvack.org \
    --cc=yunjeong.mun@sk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox