Thread (82 messages) 82 messages, 7 authors, 2018-08-20

Re: [PATCH v3 05/14] sched/cpufreq: uclamp: add utilization clamping for FAIR tasks

From: Vincent Guittot <vincent.guittot@linaro.org>
Date: 2018-08-08 13:19:15
Also in: lkml

Hi Patrick,

On Mon, 6 Aug 2018 at 18:40, Patrick Bellasi [off-list ref] wrote:
quoted hunk ↗ jump to hunk
@@ -222,8 +222,13 @@ static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu)
        util = cpu_util_cfs(rq);
+       if (util)
+               util = uclamp_util(cpu_of(rq), util);
        util += cpu_util_rt(rq);

        /*
quoted hunk ↗ jump to hunk
@@ -322,11 +328,24 @@ static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, u64 time,
+       max_boost = sg_cpu->iowait_boost_max;
+       if (!cpu_util_rt(cpu_rq(sg_cpu->cpu)))
+               max_boost = uclamp_util(sg_cpu->cpu, max_boost);
+
+static inline unsigned int uclamp_value(unsigned int cpu, int clamp_id)
+{
+       struct uclamp_cpu *uc_cpu = &cpu_rq(cpu)->uclamp;
+
+       if (uc_cpu->value[clamp_id] == UCLAMP_NOT_VALID)
+               return uclamp_none(clamp_id);
+
+       return uc_cpu->value[clamp_id];
+}
+
+static inline unsigned int uclamp_util(unsigned int cpu, unsigned int util)
using struct *rq rq instead of cpu as parameter would align
uclamp_util() interface with other cpu_util_*() interface and remove
some cpu_of(rq) and  cpu_rq(cpu)
+{
+       unsigned int min_util = uclamp_value(cpu, UCLAMP_MIN);
+       unsigned int max_util = uclamp_value(cpu, UCLAMP_MAX);
+
+       return clamp(util, min_util, max_util);
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help