Re: [PATCH 2/2] mm/damon: skip deactivated schemes in watermark checks and add fallback sleep
Liew Rui Yan <[email protected]>
| Newsgroups | dev.linux.lists.damon,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
Hi SJ, On Fri, 7 Aug 2026 07:07:39 -0700 SJ Park <[email protected]> wrote: > This is an intended implementation. > > When all schemes are deactivated by watermarks, DAMON stops monitoring. It was > implemented in the way because we didn't want DAMON consumes system resource in > the case. But, later it turned out DAMON's resource consumption is really > negligible. Rather, it is turned out that it makes DAMON runs with stale > history when it is activated again. Particularly, regions have 'age' and their > start/end addresses that was emerged before the deactivation. Those are > meaningless and could even cause wrong DAMOS decisions. > > We don't want that anymore. For a case the user really want DAMON completely > stops, we introduced 'pause'. For max_nr_snapshot-based deactivation, we don't > intend to completely stop DAMON. > > Maybe the documentation can be updated to further clarify this. Wait, according to the documentation and the code, DAMON will still stop monitoring when all schemes is deactivated. static int kdamond_wait_activation(struct damon_ctx *ctx) { /* ... */ while (!kdamond_need_stop(ctx)) { damon_for_each_scheme(s, ctx) { wait_time = damos_wmark_wait_us(s); if (!init_wait_time || wait_time < min_wait_time) { init_wait_time = true; min_wait_time = wait_time; } } if (!min_wait_time) return 0; kdamond_usleep(min_wait_time); /* ... */ } return -EBUSY; } DAMOS allows users to offload such works using three watermarks. It allows the users to configure the metric of their interest, and three watermark values, namely high, middle, and low. If the value of the metric becomes above the high watermark or below the low watermark, the scheme is deactivated. If the metric becomes below the mid watermark but above the low watermark, the scheme is activated. __If all schemes are deactivated by the watermarks, the monitoring is also deactivated__. In this case, the DAMON worker thread only periodically checks the watermarks and therefore incurs nearly zero overhead. Should this be changed to monitoring will not stop? Also this patch (0002) add a new function named damos_is_deactivated(), it checks both wmarks.activated and max_nr_snapshot conditions, and I replace the wmarks.activated-only with this new function. I am sorry if my commit message has caused you any misunderstanding. Best regards, Rui Yan