Re:Re: [PATCH] mm/damon/core: reject zero sample_interval
李佑鸿 <[email protected]> Thu, 23 Jul 2026 09:42:01 +0800 (CST)
| Newsgroups | dev.linux.lists.damon |
|---|---|
| Message-ID | <[email protected]> |
At 2026-07-22 22:01:13, "SJ Park" <[email protected]> wrote: >Hello liyouhong, > > >Thank you for sharing this patch! > >On Wed, 22 Jul 2026 17:43:04 +0800 [email protected] wrote: > >> From: liyouhong <[email protected]> >> >> damon_set_attrs() allows sample_interval == 0. Sysfs likewise accepts >> sample_us=0. kdamond_fn() then calls kdamond_usleep(0) every loop >> iteration, so kdamond busy-spins and can peg a CPU. >> >> With a zero sampling interval the access-rate accounting also diverges: >> nr_accesses_bp no longer matches nr_accesses * 10000, and >> kdamond_reset_aggregated() hits: >> >> WARNING: invalid nr_accesses_bp at reset: ... > >The warning has removed by nr_accesses_bp optimization patch series, which is >currently queued for 7.3-rc1. So the warning will not be triggered on near >future mainline. >> >> Reject sample_interval == 0 in damon_set_attrs(), which covers sysfs >> commit and other callers. damon_lru_sort already refused a zero >> sample_interval; align the core validation with that. > >This is a sort of behavioral change. I also feel this adds another corner case >that makes my head complicated. There are a few logic written under the >assumption of zero intervals. Having inconsistencies between allowed input and >handling logic will make it difficult to maintain in long term. Can't we keep >supporting zero sample interval and fix the warning or the real bug instead? > Hi SJ, Thanks for the explanation. I agree rejecting zero sample_interval is the wrong approach, especially since the warning will be gone with your queued series. Thanks, liyouhong