Re: [PATCH] mm/damon: reject zero sampling interval

From: SeongJae Park

Date: Thu Sep 17 2026 - 22:39:18 EST


Hi Karthikeyan and Sang-Heon,

On Thu, 17 Sep 2026 18:00:13 +0000 Karthikeyan KS <karthiproffesional@xxxxxxxxx> wrote:

> Hi Sang-Heon, Hi SJ,
>
> > I think SJ already commented on a similar patch. please refer to [1]
> >
> > [1] https://lore.kernel.org/all/20260722094304.3132750-1-dayou5941@xxxxxxx/

Thank you for pointing this out, Sang-Heon!

>
> Thanks, missed that thread. Same objection applies to mine.
>
> > Can't we keep supporting zero sample interval and fix the warning
> > or the real bug instead?
>
> I measured a few floors for kdamond_usleep():
>
> floor kdamond CPU (3s) vs sample_us=5000
> 1us 84% 28x
> 100us 42% 14x
> 1000us 12% ~3x
> 5000us ~2% 1x (matches control)
>
> 5000us is damon_new_ctx()'s own default, and at that floor the spin
> is just gone.
>
> Would you rather we just document sample_us=0 as accepted/expected
> behavior, or clamp it to that default inside damon_set_attrs()?

I'd prefer adding a comment saying zero sampling interval is accepted. I think
damon_attr kernel-doc comment is a good place for adding that.


Thanks,
SJ

[...]