sched/rt: Add borrowing time condition
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
Signed-off-by Zhang Qiang <[email protected]>
--- kernel/sched/rt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/sched/rt.c +4 -2
@@ -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