|
@@ -4590,6 +4590,7 @@ void __refill_cfs_bandwidth_runtime(struct cfs_bandwidth *cfs_b)
|
|
|
now = sched_clock_cpu(smp_processor_id());
|
|
|
cfs_b->runtime = cfs_b->quota;
|
|
|
cfs_b->runtime_expires = now + ktime_to_ns(cfs_b->period);
|
|
|
+ cfs_b->expires_seq++;
|
|
|
}
|
|
|
|
|
|
static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
|
|
@@ -4612,6 +4613,7 @@ static int assign_cfs_rq_runtime(struct cfs_rq *cfs_rq)
|
|
|
struct task_group *tg = cfs_rq->tg;
|
|
|
struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(tg);
|
|
|
u64 amount = 0, min_amount, expires;
|
|
|
+ int expires_seq;
|
|
|
|
|
|
/* note: this is a positive sum as runtime_remaining <= 0 */
|
|
|
min_amount = sched_cfs_bandwidth_slice() - cfs_rq->runtime_remaining;
|
|
@@ -4628,6 +4630,7 @@ static int assign_cfs_rq_runtime(struct cfs_rq *cfs_rq)
|
|
|
cfs_b->idle = 0;
|
|
|
}
|
|
|
}
|
|
|
+ expires_seq = cfs_b->expires_seq;
|
|
|
expires = cfs_b->runtime_expires;
|
|
|
raw_spin_unlock(&cfs_b->lock);
|
|
|
|
|
@@ -4637,8 +4640,10 @@ static int assign_cfs_rq_runtime(struct cfs_rq *cfs_rq)
|
|
|
* spread between our sched_clock and the one on which runtime was
|
|
|
* issued.
|
|
|
*/
|
|
|
- if ((s64)(expires - cfs_rq->runtime_expires) > 0)
|
|
|
+ if (cfs_rq->expires_seq != expires_seq) {
|
|
|
+ cfs_rq->expires_seq = expires_seq;
|
|
|
cfs_rq->runtime_expires = expires;
|
|
|
+ }
|
|
|
|
|
|
return cfs_rq->runtime_remaining > 0;
|
|
|
}
|
|
@@ -4664,12 +4669,9 @@ static void expire_cfs_rq_runtime(struct cfs_rq *cfs_rq)
|
|
|
* has not truly expired.
|
|
|
*
|
|
|
* Fortunately we can check determine whether this the case by checking
|
|
|
- * whether the global deadline has advanced. It is valid to compare
|
|
|
- * cfs_b->runtime_expires without any locks since we only care about
|
|
|
- * exact equality, so a partial write will still work.
|
|
|
+ * whether the global deadline(cfs_b->expires_seq) has advanced.
|
|
|
*/
|
|
|
-
|
|
|
- if (cfs_rq->runtime_expires != cfs_b->runtime_expires) {
|
|
|
+ if (cfs_rq->expires_seq == cfs_b->expires_seq) {
|
|
|
/* extend local deadline, drift is bounded above by 2 ticks */
|
|
|
cfs_rq->runtime_expires += TICK_NSEC;
|
|
|
} else {
|