sched/uclamp: Fix incorrect uclamp.latency_sensitive setting

This patch fixes the latency_sensitive flag for all cpuset cgroups, and
the value present in the uclamp.latency_sensitive node directly
corresponds to the task_group's latency_sensitive value.

Prior to this patch, this was not the case. The
uclamp_latency_sensitive() function applied values only to the cpu
cgroup subsys instead of the required cpuset cgroup subsys, as a
result of which the latency_sensitive value remained zero for all
taskgroups irrespective of its setting.

Also, fix a situation where latency_sensitive is enabled for the
cpuset's root cgroup, in which case all tasks will have their value
as 1, which in turn will enable prefer_idle for all tasks. This is
undesired and may cause high battery drain.
This commit is contained in:
darkhz 2021-01-18 12:10:18 +05:30 committed by Ksawlii
parent de53544dd2
commit bf2ac59ec9

View file

@ -2595,11 +2595,15 @@ static inline bool uclamp_rq_is_idle(struct rq *rq)
#ifdef CONFIG_UCLAMP_TASK_GROUP
static inline bool uclamp_latency_sensitive(struct task_struct *p)
{
struct cgroup_subsys_state *css = task_css(p, cpu_cgrp_id);
struct cgroup_subsys_state *css = task_css(p, cpuset_cgrp_id);
struct task_group *tg;
if (!css)
return false;
if (!strlen(css->cgroup->kn->name))
return 0;
tg = container_of(css, struct task_group, css);
return tg->latency_sensitive;