Lines Matching refs:quota

302 static struct damos_quota *damos_quota_init_priv(struct damos_quota *quota)
304 quota->total_charged_sz = 0;
305 quota->total_charged_ns = 0;
306 quota->esz = 0;
307 quota->charged_sz = 0;
308 quota->charged_from = 0;
309 quota->charge_target_from = NULL;
310 quota->charge_addr_from = 0;
311 return quota;
315 enum damos_action action, struct damos_quota *quota,
329 scheme->quota = *(damos_quota_init_priv(quota));
781 if (!ret || !s->quota.esz || !c->ops.get_scheme_score)
784 return c->ops.get_scheme_score(c, t, r, s) >= s->quota.min_score;
789 * it is already charged for the DAMOS quota.
794 * If a quota of a scheme has exceeded in a quota charge window, the scheme's
813 struct damos_quota *quota = &s->quota;
817 if (quota->charge_target_from) {
818 if (t != quota->charge_target_from)
821 quota->charge_target_from = NULL;
822 quota->charge_addr_from = 0;
825 if (quota->charge_addr_from &&
826 r->ar.end <= quota->charge_addr_from)
829 if (quota->charge_addr_from && r->ar.start <
830 quota->charge_addr_from) {
831 sz_to_skip = ALIGN_DOWN(quota->charge_addr_from -
842 quota->charge_target_from = NULL;
843 quota->charge_addr_from = 0;
921 struct damos_quota *quota = &s->quota;
928 if (quota->esz && quota->charged_sz + sz > quota->esz) {
929 sz = ALIGN_DOWN(quota->esz - quota->charged_sz,
943 quota->total_charged_ns += timespec64_to_ns(&end) -
945 quota->charged_sz += sz;
946 if (quota->esz && quota->charged_sz >= quota->esz) {
947 quota->charge_target_from = t;
948 quota->charge_addr_from = r->ar.end + 1;
965 struct damos_quota *quota = &s->quota;
970 /* Check the quota */
971 if (quota->esz && quota->charged_sz >= quota->esz)
984 /* Shouldn't be called if quota->ms and quota->sz are zero */
985 static void damos_set_effective_quota(struct damos_quota *quota)
990 if (!quota->ms) {
991 quota->esz = quota->sz;
995 if (quota->total_charged_ns)
996 throughput = quota->total_charged_sz * 1000000 /
997 quota->total_charged_ns;
1000 esz = throughput * quota->ms;
1002 if (quota->sz && quota->sz < esz)
1003 esz = quota->sz;
1004 quota->esz = esz;
1009 struct damos_quota *quota = &s->quota;
1015 if (!quota->ms && !quota->sz)
1019 if (time_after_eq(jiffies, quota->charged_from +
1020 msecs_to_jiffies(quota->reset_interval))) {
1021 if (quota->esz && quota->charged_sz >= quota->esz)
1023 quota->total_charged_sz += quota->charged_sz;
1024 quota->charged_from = jiffies;
1025 quota->charged_sz = 0;
1026 damos_set_effective_quota(quota);
1033 memset(quota->histogram, 0, sizeof(quota->histogram));
1039 quota->histogram[score] += damon_sz_region(r);
1047 cumulated_sz += quota->histogram[score];
1048 if (cumulated_sz >= quota->esz || !score)
1051 quota->min_score = score;