Lines Matching full:scheme
318 struct damos *scheme; in damon_new_scheme() local
320 scheme = kmalloc(sizeof(*scheme), GFP_KERNEL); in damon_new_scheme()
321 if (!scheme) in damon_new_scheme()
323 scheme->pattern = *pattern; in damon_new_scheme()
324 scheme->action = action; in damon_new_scheme()
325 INIT_LIST_HEAD(&scheme->filters); in damon_new_scheme()
326 scheme->stat = (struct damos_stat){}; in damon_new_scheme()
327 INIT_LIST_HEAD(&scheme->list); in damon_new_scheme()
329 scheme->quota = *(damos_quota_init_priv(quota)); in damon_new_scheme()
331 scheme->wmarks = *wmarks; in damon_new_scheme()
332 scheme->wmarks.activated = true; in damon_new_scheme()
334 return scheme; in damon_new_scheme()
792 * @s: The scheme to be applied.
794 * If a quota of a scheme has exceeded in a quota charge window, the scheme's
796 * regions. To avoid applying the scheme action to only already applied
797 * regions, DAMON skips applying the scheme action to the regions that charged
1261 * Returns zero if the scheme is active. Else, returns time to wait for next
1264 static unsigned long damos_wmark_wait_us(struct damos *scheme) in damos_wmark_wait_us() argument
1268 if (scheme->wmarks.metric == DAMOS_WMARK_NONE) in damos_wmark_wait_us()
1271 metric = damos_wmark_metric_value(scheme->wmarks.metric); in damos_wmark_wait_us()
1273 if (metric > scheme->wmarks.high || scheme->wmarks.low > metric) { in damos_wmark_wait_us()
1274 if (scheme->wmarks.activated) in damos_wmark_wait_us()
1275 pr_debug("deactivate a scheme (%d) for %s wmark\n", in damos_wmark_wait_us()
1276 scheme->action, in damos_wmark_wait_us()
1277 metric > scheme->wmarks.high ? in damos_wmark_wait_us()
1279 scheme->wmarks.activated = false; in damos_wmark_wait_us()
1280 return scheme->wmarks.interval; in damos_wmark_wait_us()
1284 if ((scheme->wmarks.high >= metric && metric >= scheme->wmarks.mid) && in damos_wmark_wait_us()
1285 !scheme->wmarks.activated) in damos_wmark_wait_us()
1286 return scheme->wmarks.interval; in damos_wmark_wait_us()
1288 if (!scheme->wmarks.activated) in damos_wmark_wait_us()
1289 pr_debug("activate a scheme (%d)\n", scheme->action); in damos_wmark_wait_us()
1290 scheme->wmarks.activated = true; in damos_wmark_wait_us()