Lines Matching refs:quota
79 enum damos_action action, struct damos_quota *quota, in damon_new_scheme() argument
97 scheme->quota.ms = quota->ms; in damon_new_scheme()
98 scheme->quota.sz = quota->sz; in damon_new_scheme()
99 scheme->quota.reset_interval = quota->reset_interval; in damon_new_scheme()
100 scheme->quota.weight_sz = quota->weight_sz; in damon_new_scheme()
101 scheme->quota.weight_nr_accesses = quota->weight_nr_accesses; in damon_new_scheme()
102 scheme->quota.weight_age = quota->weight_age; in damon_new_scheme()
103 scheme->quota.total_charged_sz = 0; in damon_new_scheme()
104 scheme->quota.total_charged_ns = 0; in damon_new_scheme()
105 scheme->quota.esz = 0; in damon_new_scheme()
106 scheme->quota.charged_sz = 0; in damon_new_scheme()
107 scheme->quota.charged_from = 0; in damon_new_scheme()
108 scheme->quota.charge_target_from = NULL; in damon_new_scheme()
109 scheme->quota.charge_addr_from = 0; in damon_new_scheme()
552 if (!ret || !s->quota.esz || !c->primitive.get_scheme_score) in damos_valid_target()
555 return c->primitive.get_scheme_score(c, t, r, s) >= s->quota.min_score; in damos_valid_target()
565 struct damos_quota *quota = &s->quota; in damon_do_apply_schemes() local
574 if (quota->esz && quota->charged_sz >= quota->esz) in damon_do_apply_schemes()
578 if (quota->charge_target_from) { in damon_do_apply_schemes()
579 if (t != quota->charge_target_from) in damon_do_apply_schemes()
582 quota->charge_target_from = NULL; in damon_do_apply_schemes()
583 quota->charge_addr_from = 0; in damon_do_apply_schemes()
586 if (quota->charge_addr_from && in damon_do_apply_schemes()
587 r->ar.end <= quota->charge_addr_from) in damon_do_apply_schemes()
590 if (quota->charge_addr_from && r->ar.start < in damon_do_apply_schemes()
591 quota->charge_addr_from) { in damon_do_apply_schemes()
592 sz = ALIGN_DOWN(quota->charge_addr_from - in damon_do_apply_schemes()
604 quota->charge_target_from = NULL; in damon_do_apply_schemes()
605 quota->charge_addr_from = 0; in damon_do_apply_schemes()
613 if (quota->esz && in damon_do_apply_schemes()
614 quota->charged_sz + sz > quota->esz) { in damon_do_apply_schemes()
615 sz = ALIGN_DOWN(quota->esz - quota->charged_sz, in damon_do_apply_schemes()
624 quota->total_charged_ns += timespec64_to_ns(&end) - in damon_do_apply_schemes()
626 quota->charged_sz += sz; in damon_do_apply_schemes()
627 if (quota->esz && quota->charged_sz >= quota->esz) { in damon_do_apply_schemes()
628 quota->charge_target_from = t; in damon_do_apply_schemes()
629 quota->charge_addr_from = r->ar.end + 1; in damon_do_apply_schemes()
645 static void damos_set_effective_quota(struct damos_quota *quota) in damos_set_effective_quota() argument
650 if (!quota->ms) { in damos_set_effective_quota()
651 quota->esz = quota->sz; in damos_set_effective_quota()
655 if (quota->total_charged_ns) in damos_set_effective_quota()
656 throughput = quota->total_charged_sz * 1000000 / in damos_set_effective_quota()
657 quota->total_charged_ns; in damos_set_effective_quota()
660 esz = throughput * quota->ms; in damos_set_effective_quota()
662 if (quota->sz && quota->sz < esz) in damos_set_effective_quota()
663 esz = quota->sz; in damos_set_effective_quota()
664 quota->esz = esz; in damos_set_effective_quota()
674 struct damos_quota *quota = &s->quota; in kdamond_apply_schemes() local
681 if (!quota->ms && !quota->sz) in kdamond_apply_schemes()
685 if (time_after_eq(jiffies, quota->charged_from + in kdamond_apply_schemes()
687 quota->reset_interval))) { in kdamond_apply_schemes()
688 if (quota->esz && quota->charged_sz >= quota->esz) in kdamond_apply_schemes()
690 quota->total_charged_sz += quota->charged_sz; in kdamond_apply_schemes()
691 quota->charged_from = jiffies; in kdamond_apply_schemes()
692 quota->charged_sz = 0; in kdamond_apply_schemes()
693 damos_set_effective_quota(quota); in kdamond_apply_schemes()
700 memset(quota->histogram, 0, sizeof(quota->histogram)); in kdamond_apply_schemes()
707 quota->histogram[score] += in kdamond_apply_schemes()
716 cumulated_sz += quota->histogram[score]; in kdamond_apply_schemes()
717 if (cumulated_sz >= quota->esz || !score) in kdamond_apply_schemes()
720 quota->min_score = score; in kdamond_apply_schemes()