[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200520080911.27367-1-qiang.zhang@windriver.com>
Date: Wed, 20 May 2020 16:09:11 +0800
From: <qiang.zhang@...driver.com>
To: <mingo@...hat.com>, <peterz@...radead.org>,
<juri.lelli@...hat.com>, <vincent.guittot@...aro.org>,
<dietmar.eggemann@....com>, <rostedt@...dmis.org>,
<bsegall@...gle.com>, <mgorman@...e.de>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH] sched/rt: Add borrowing time condition
From: Zhang Qiang <qiang.zhang@...driver.com>
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 <qiang.zhang@...driver.com>
---
kernel/sched/rt.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 4043abe45459..d2a1acad6687 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -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;
--
2.17.0
Powered by blists - more mailing lists