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

From: Karthikeyan KS

Date: Thu Sep 17 2026 - 19:11:17 EST


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/

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()?

Thanks,
Karthikeyan KS