lkml.org 
[lkml]   [2018]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4 v4] cpufreq/schedutil: add rt utilization tracking
Date
add both cfs and rt utilization when selecting an OPP as rt can preempt and
steal cfs's running time

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
kernel/sched/cpufreq_schedutil.c | 4 +++-
kernel/sched/sched.h | 7 +++++++
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 89fe78e..7ce0643 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -56,6 +56,7 @@ struct sugov_cpu {
/* The fields below are only needed when sharing a policy: */
unsigned long util_cfs;
unsigned long util_dl;
+ unsigned long util_rt;
unsigned long max;

/* The field below is for single-CPU policies only: */
@@ -178,6 +179,7 @@ static void sugov_get_util(struct sugov_cpu *sg_cpu)
sg_cpu->max = arch_scale_cpu_capacity(NULL, sg_cpu->cpu);
sg_cpu->util_cfs = cpu_util_cfs(rq);
sg_cpu->util_dl = cpu_util_dl(rq);
+ sg_cpu->util_rt = cpu_util_rt(rq);
}

static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu)
@@ -190,7 +192,7 @@ static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu)
} else {
util = sg_cpu->util_dl;
if (rq->cfs.h_nr_running)
- util += sg_cpu->util_cfs;
+ util += sg_cpu->util_cfs + sg_cpu->util_rt;
}

/*
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index a8003a9..b8784be 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2186,4 +2186,11 @@ static inline unsigned long cpu_util_cfs(struct rq *rq)
{
return rq->cfs.avg.util_avg;
}
+
+static inline unsigned long cpu_util_rt(struct rq *rq)
+{
+ return rq->rt.avg.util_avg;
+}
+
+
#endif
--
2.7.4
\
 
 \ /
  Last update: 2018-03-16 12:27    [W:0.120 / U:3.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site