Lines Matching defs:scheme
318 struct damos *scheme;
320 scheme = kmalloc(sizeof(*scheme), GFP_KERNEL);
321 if (!scheme)
323 scheme->pattern = *pattern;
324 scheme->action = action;
325 INIT_LIST_HEAD(&scheme->filters);
326 scheme->stat = (struct damos_stat){};
327 INIT_LIST_HEAD(&scheme->list);
329 scheme->quota = *(damos_quota_init_priv(quota));
331 scheme->wmarks = *wmarks;
332 scheme->wmarks.activated = true;
334 return 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)
1268 if (scheme->wmarks.metric == DAMOS_WMARK_NONE)
1271 metric = damos_wmark_metric_value(scheme->wmarks.metric);
1273 if (metric > scheme->wmarks.high || scheme->wmarks.low > metric) {
1274 if (scheme->wmarks.activated)
1275 pr_debug("deactivate a scheme (%d) for %s wmark\n",
1276 scheme->action,
1277 metric > scheme->wmarks.high ?
1279 scheme->wmarks.activated = false;
1280 return scheme->wmarks.interval;
1284 if ((scheme->wmarks.high >= metric && metric >= scheme->wmarks.mid) &&
1285 !scheme->wmarks.activated)
1286 return scheme->wmarks.interval;
1288 if (!scheme->wmarks.activated)
1289 pr_debug("activate a scheme (%d)\n", scheme->action);
1290 scheme->wmarks.activated = true;