|
@@ -7436,7 +7436,12 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota)
|
|
|
|
|
|
runtime_enabled = quota != RUNTIME_INF;
|
|
runtime_enabled = quota != RUNTIME_INF;
|
|
runtime_was_enabled = cfs_b->quota != RUNTIME_INF;
|
|
runtime_was_enabled = cfs_b->quota != RUNTIME_INF;
|
|
- account_cfs_bandwidth_used(runtime_enabled, runtime_was_enabled);
|
|
|
|
|
|
+ /*
|
|
|
|
+ * If we need to toggle cfs_bandwidth_used, off->on must occur
|
|
|
|
+ * before making related changes, and on->off must occur afterwards
|
|
|
|
+ */
|
|
|
|
+ if (runtime_enabled && !runtime_was_enabled)
|
|
|
|
+ cfs_bandwidth_usage_inc();
|
|
raw_spin_lock_irq(&cfs_b->lock);
|
|
raw_spin_lock_irq(&cfs_b->lock);
|
|
cfs_b->period = ns_to_ktime(period);
|
|
cfs_b->period = ns_to_ktime(period);
|
|
cfs_b->quota = quota;
|
|
cfs_b->quota = quota;
|
|
@@ -7462,6 +7467,8 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota)
|
|
unthrottle_cfs_rq(cfs_rq);
|
|
unthrottle_cfs_rq(cfs_rq);
|
|
raw_spin_unlock_irq(&rq->lock);
|
|
raw_spin_unlock_irq(&rq->lock);
|
|
}
|
|
}
|
|
|
|
+ if (runtime_was_enabled && !runtime_enabled)
|
|
|
|
+ cfs_bandwidth_usage_dec();
|
|
out_unlock:
|
|
out_unlock:
|
|
mutex_unlock(&cfs_constraints_mutex);
|
|
mutex_unlock(&cfs_constraints_mutex);
|
|
|
|
|