Lines Matching full:scheme
383 struct damos *scheme; in damon_new_scheme() local
385 scheme = kmalloc(sizeof(*scheme), GFP_KERNEL); in damon_new_scheme()
386 if (!scheme) in damon_new_scheme()
388 scheme->pattern = *pattern; in damon_new_scheme()
389 scheme->action = action; in damon_new_scheme()
390 scheme->apply_interval_us = apply_interval_us; in damon_new_scheme()
396 scheme->next_apply_sis = 0; in damon_new_scheme()
397 scheme->walk_completed = false; in damon_new_scheme()
398 INIT_LIST_HEAD(&scheme->filters); in damon_new_scheme()
399 INIT_LIST_HEAD(&scheme->ops_filters); in damon_new_scheme()
400 scheme->stat = (struct damos_stat){}; in damon_new_scheme()
401 INIT_LIST_HEAD(&scheme->list); in damon_new_scheme()
403 scheme->quota = *(damos_quota_init(quota)); in damon_new_scheme()
405 INIT_LIST_HEAD(&scheme->quota.goals); in damon_new_scheme()
407 scheme->wmarks = *wmarks; in damon_new_scheme()
408 scheme->wmarks.activated = true; in damon_new_scheme()
410 scheme->target_nid = target_nid; in damon_new_scheme()
412 return scheme; in damon_new_scheme()
1366 * invocation, for each scheme. The given callback function can hence safely
1368 * each of the scheme will apply the action for next interval, without
1369 * additional synchronizations against the kdamond. If every scheme of @ctx
1506 * @s: The scheme to be applied.
1508 * If a quota of a scheme has exceeded in a quota charge window, the scheme's
1510 * regions. To avoid applying the scheme action to only already applied
1511 * regions, DAMON skips applying the scheme action to the regions that charged
1643 * @s: The scheme of @ctx that will be applied to @r.
1646 * apply a DAMOS scheme action to a region. If a DAMOS walk request is
1668 * @s: A scheme of @ctx that all walks are now done.
1671 * scheme to all regions that eligible for the given &damos->apply_interval_us.
1672 * If every scheme of @ctx including @s now finished walking for at least one
1703 * walk is requested but there is no DAMOS scheme to walk for, or the kdamond
2263 * Returns zero if the scheme is active. Else, returns time to wait for next
2266 static unsigned long damos_wmark_wait_us(struct damos *scheme) in damos_wmark_wait_us() argument
2270 if (damos_get_wmark_metric_value(scheme->wmarks.metric, &metric)) in damos_wmark_wait_us()
2274 if (metric > scheme->wmarks.high || scheme->wmarks.low > metric) { in damos_wmark_wait_us()
2275 if (scheme->wmarks.activated) in damos_wmark_wait_us()
2276 pr_debug("deactivate a scheme (%d) for %s wmark\n", in damos_wmark_wait_us()
2277 scheme->action, in damos_wmark_wait_us()
2278 str_high_low(metric > scheme->wmarks.high)); in damos_wmark_wait_us()
2279 scheme->wmarks.activated = false; in damos_wmark_wait_us()
2280 return scheme->wmarks.interval; in damos_wmark_wait_us()
2284 if ((scheme->wmarks.high >= metric && metric >= scheme->wmarks.mid) && in damos_wmark_wait_us()
2285 !scheme->wmarks.activated) in damos_wmark_wait_us()
2286 return scheme->wmarks.interval; in damos_wmark_wait_us()
2288 if (!scheme->wmarks.activated) in damos_wmark_wait_us()
2289 pr_debug("activate a scheme (%d)\n", scheme->action); in damos_wmark_wait_us()
2290 scheme->wmarks.activated = true; in damos_wmark_wait_us()
2370 struct damos *scheme; in kdamond_init_ctx() local
2379 damon_for_each_scheme(scheme, ctx) { in kdamond_init_ctx()
2380 apply_interval = scheme->apply_interval_us ? in kdamond_init_ctx()
2381 scheme->apply_interval_us : ctx->attrs.aggr_interval; in kdamond_init_ctx()
2382 scheme->next_apply_sis = apply_interval / sample_interval; in kdamond_init_ctx()
2383 damos_set_filters_default_reject(scheme); in kdamond_init_ctx()