lkml.org 
[lkml]   [2013]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch v7 09/21] sched: get rq potential maximum utilization
Date
Since the rt task priority is higher than fair tasks, cfs_rq utilization
is just the left of rt utilization.

When there are some cfs tasks in queue, the potential utilization may
be yielded, so mulitiplying cfs task number to get max potential
utilization of cfs. Then the rq utilization is sum of rt util and cfs
util.

Thanks for Paul Turner and Namhyung's reminder!

Signed-off-by: Alex Shi <alex.shi@intel.com>
---
kernel/sched/fair.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c47933f..70a99c9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3350,6 +3350,27 @@ struct sg_lb_stats {
unsigned int group_util; /* sum utilization of group */
};

+static unsigned long scale_rt_util(int cpu);
+
+/*
+ * max_rq_util - get the possible maximum cpu utilization
+ */
+static unsigned int max_rq_util(int cpu)
+{
+ struct rq *rq = cpu_rq(cpu);
+ unsigned int rt_util = scale_rt_util(cpu);
+ unsigned int cfs_util;
+ unsigned int nr_running;
+
+ /* yield cfs utilization to rt's, if total utilization > 100% */
+ cfs_util = min(rq->util, (unsigned int)(FULL_UTIL - rt_util));
+
+ /* count transitory task utilization */
+ nr_running = max(rq->cfs.h_nr_running, (unsigned int)1);
+
+ return rt_util + cfs_util * nr_running;
+}
+
/*
* sched_balance_self: balance the current task (running on cpu) in domains
* that have the 'flag' flag set. In practice, this is SD_BALANCE_FORK and
--
1.7.12


\
 
 \ /
  Last update: 2013-04-04 04:41    [W:0.127 / U:4.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site