linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/rt: Add borrowing time condition
@ 2020-05-20  8:09 qiang.zhang
  0 siblings, 0 replies; only message in thread
From: qiang.zhang @ 2020-05-20  8:09 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman
  Cc: linux-kernel

From: Zhang Qiang <qiang.zhang@windriver.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@windriver.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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-20  8:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20  8:09 [PATCH] sched/rt: Add borrowing time condition qiang.zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).