Skip to contentSkip to conversation

sched/rt: Add borrowing time condition

PATCH New [email protected] 1 participant 1 message May 20, 2020 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/rt: Add borrowing time condition

From: Zhang Qiang <[email protected]>

Add priority judgment to determine whether to borrow time from neighbors, ensure that the rt_runntime of rt_rq with higher priority tasks is not reduced

---
 kernel/sched/rt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/sched/rt.c +4 -2
index 4043abe45459..d2a1acad6687 100644
@@ -711,8 +711,10 @@ static void do_balance_runtime(struct rt_rq *rt_rq)
 			diff = div_u64((u64)diff, weight);
 			if (rt_rq->rt_runtime + diff > rt_period)
 				diff = rt_period - rt_rq->rt_runtime;
-			iter->rt_runtime -= diff;
-			rt_rq->rt_runtime += diff;
+			if (rt_rq->highest_prio.curr < iter->highest_prio.curr) {
+				iter->rt_runtime -= diff;
+				rt_rq->rt_runtime += diff;
+			}
 			if (rt_rq->rt_runtime == rt_period) {
 				raw_spin_unlock(&iter->rt_runtime_lock);
 				break;
Signature · 1 line
2.17.0