瀏覽代碼

sched: rt-bandwidth accounting fix

It fixes an accounting bug where we would continue accumulating runtime
even though the bandwidth control is disabled. This would lead to very long
throttle periods once bandwidth control gets turned on again.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Peter Zijlstra 17 年之前
父節點
當前提交
cc2991cf15
共有 1 個文件被更改,包括 5 次插入6 次删除
  1. 5 6
      kernel/sched_rt.c

+ 5 - 6
kernel/sched_rt.c

@@ -440,9 +440,6 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
 {
 {
 	u64 runtime = sched_rt_runtime(rt_rq);
 	u64 runtime = sched_rt_runtime(rt_rq);
 
 
-	if (runtime == RUNTIME_INF)
-		return 0;
-
 	if (rt_rq->rt_throttled)
 	if (rt_rq->rt_throttled)
 		return rt_rq_throttled(rt_rq);
 		return rt_rq_throttled(rt_rq);
 
 
@@ -493,9 +490,11 @@ static void update_curr_rt(struct rq *rq)
 		rt_rq = rt_rq_of_se(rt_se);
 		rt_rq = rt_rq_of_se(rt_se);
 
 
 		spin_lock(&rt_rq->rt_runtime_lock);
 		spin_lock(&rt_rq->rt_runtime_lock);
-		rt_rq->rt_time += delta_exec;
-		if (sched_rt_runtime_exceeded(rt_rq))
-			resched_task(curr);
+		if (sched_rt_runtime(rt_rq) != RUNTIME_INF) {
+			rt_rq->rt_time += delta_exec;
+			if (sched_rt_runtime_exceeded(rt_rq))
+				resched_task(curr);
+		}
 		spin_unlock(&rt_rq->rt_runtime_lock);
 		spin_unlock(&rt_rq->rt_runtime_lock);
 	}
 	}
 }
 }