public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Liew Rui Yan <aethernet65535@gmail.com>
To: sj@kernel.org
Cc: aethernet65535@gmail.com, damon@lists.linux.dev, linux-mm@kvack.org
Subject: Re: [PATCH] mm/damon: validate addr_unit to be power of 2
Date: Sun, 29 Mar 2026 15:51:07 +0800	[thread overview]
Message-ID: <20260329075107.36402-1-aethernet65535@gmail.com> (raw)
In-Reply-To: <20260329032054.2443-1-sj@kernel.org>

Hi SeongJae,

On Sat, 28 Mar 2026 20:20:54 -0700 SeongJae Park <sj@kernel.org> wrote:

> On Sun, 29 Mar 2026 02:43:19 +0800 Liew Rui Yan <aethernet65535@gmail.com> wrote:
> 
> > Apologize if my previous email was unclear. Let me directly address your
> > two suggestion.
> > 
> > 1. DAMON_SYSFS Type [1]:
> >    I fully agree with this. Centralizing the validation in
> >    damon_commit_ctx() is the right approach to avoid "whack-a-mole"
> >    problem. This is exactly what I am proposing.
> 
> Thank you for clarifying this.  Thanks to that I can show where you are coming
> from.  You are misunderstanding what I'm suggesting.  I should have explained
> it in more detail.  With this option, I'm not suggesting to update
> damon_copmmit_ctx() but the callers, in a way similar to that for DAMON_SYSFS.
> 
> > 
> > 2. Adding a simple check on existing validation logic (in callers?) [2]:
> >    While this is simpler to implement, I prefer avoiding it for the
> >    "whack-a-mole".
> 
> I suggested option 1 as a way to avoid "whack-a-mole".  I didn't suggest
> updting damon_commit_ctx() as the way.
> 
> But, the given problem is clear and local.  Validation of addr_unit in
> DAMON_RECLAIM and DAMON_LRU_SORT.  There is no problem in DAMON_SYSFS.  So I'd
> prefer simpler appraoch on local callers that having problem.
> 
> In future, we can make centuralized appraoch, in a way somewhat similar to what
> DAMON_SYSFS is doing.  But that's somewhat we can think in future.  For a given
> problem, let's fix it first.
> 
> > 
> > So, to clarify, I choose your first option (centralized check), and I
> > believe my "Option 2" is the simple way to implement it.
> > 
> > Does ths align with your expectation? If so, I will proceed with this
> > approach.
> 
> So, no, I think we were misunderstanding each other, and I think I understand
> you more now, thanks to your clarification.  Also, please don't hesitate at
> asking more questions to me if any of my suggestion is unclear.
> 
> In short, for this given specific issue, I'd prefer the option 2.  Is this
> clear?

Thank you for the clarification! I may understand your point now.

So, you prefer to keep the fix local to the modules that have the issue
(addr_unit_store()), rather than changing the CORE damon_commit_ctx()?

To confirm, are you suggesting something like the first approach [1]?

    if (input_addr_unit < PAGE_SIZE && !is_power_of_2(input_addr_unit))
        return -EINVAL;

[1] https://lore.kernel.org/20260325071709.9699-1-aethernet65535@gmail.com

Best regards,
Rui Yan


  reply	other threads:[~2026-03-29  7:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27  6:26 [PATCH] mm/damon: validate addr_unit to be power of 2 Liew Rui Yan
2026-03-27  6:45 ` Liew Rui Yan
2026-03-27 12:10   ` Liew Rui Yan
2026-03-27  8:11 ` (sashiko review) " Liew Rui Yan
2026-03-27  8:27   ` Liew Rui Yan
2026-03-27 14:14 ` SeongJae Park
2026-03-27 14:56   ` Liew Rui Yan
2026-03-28  0:14     ` SeongJae Park
2026-03-28  2:26       ` Liew Rui Yan
2026-03-28 13:29         ` SeongJae Park
2026-03-28 14:13           ` SeongJae Park
2026-03-28 17:44             ` Liew Rui Yan
2026-03-28 18:06               ` SeongJae Park
2026-03-28 18:43                 ` Liew Rui Yan
2026-03-29  3:20                   ` SeongJae Park
2026-03-29  7:51                     ` Liew Rui Yan [this message]
2026-03-29 15:15                       ` 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=20260329075107.36402-1-aethernet65535@gmail.com \
    --to=aethernet65535@gmail.com \
    --cc=damon@lists.linux.dev \
    --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