summaryrefslogtreecommitdiff
path: root/kernel/sched/tune.c
diff options
context:
space:
mode:
authorSrinath Sridharan <srinathsr@google.com>2016-07-14 13:09:03 -0700
committerJohn Stultz <john.stultz@linaro.org>2016-08-11 14:26:49 -0700
commitc5a00c2dad8d161da3c2086cccd6375d8ad5b04f (patch)
tree45338f8f9fa792bcc1f791ea344a7d64ac31a9f0 /kernel/sched/tune.c
parentd4cda03828f5c8eae35efcb08f520f8f1a35950e (diff)
sched/tune: Introducing a new schedtune attribute prefer_idle
Hint to enable biasing of tasks towards idle cpus, even when a given task is negatively boosted. The mechanism allows upto 20% reduction in camera power without hurting performance. bug: 28312446 Change-Id: I97ea5671aa1e6bcb165408b41e17bc82e41c2c9e
Diffstat (limited to 'kernel/sched/tune.c')
-rw-r--r--kernel/sched/tune.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/kernel/sched/tune.c b/kernel/sched/tune.c
index d24f365b0c90..644f8e9ee96f 100644
--- a/kernel/sched/tune.c
+++ b/kernel/sched/tune.c
@@ -125,6 +125,10 @@ struct schedtune {
/* Performance Constraint (C) region threshold params */
int perf_constrain_idx;
+
+ /* Hint to bias scheduling of tasks on that SchedTune CGroup
+ * towards idle CPUs */
+ int prefer_idle;
};
static inline struct schedtune *css_st(struct cgroup_subsys_state *css)
@@ -156,6 +160,7 @@ root_schedtune = {
.boost = 0,
.perf_boost_idx = 0,
.perf_constrain_idx = 0,
+ .prefer_idle = 0,
};
int
@@ -536,6 +541,38 @@ int schedtune_task_boost(struct task_struct *p)
return task_boost;
}
+int schedtune_prefer_idle(struct task_struct *p)
+{
+ struct schedtune *st;
+ int prefer_idle;
+
+ /* Get prefer_idle value */
+ rcu_read_lock();
+ st = task_schedtune(p);
+ prefer_idle = st->prefer_idle;
+ rcu_read_unlock();
+
+ return prefer_idle;
+}
+
+static u64
+prefer_idle_read(struct cgroup_subsys_state *css, struct cftype *cft)
+{
+ struct schedtune *st = css_st(css);
+
+ return st->prefer_idle;
+}
+
+static int
+prefer_idle_write(struct cgroup_subsys_state *css, struct cftype *cft,
+ u64 prefer_idle)
+{
+ struct schedtune *st = css_st(css);
+ st->prefer_idle = prefer_idle;
+
+ return 0;
+}
+
static s64
boost_read(struct cgroup_subsys_state *css, struct cftype *cft)
{
@@ -587,6 +624,11 @@ static struct cftype files[] = {
.read_s64 = boost_read,
.write_s64 = boost_write,
},
+ {
+ .name = "prefer_idle",
+ .read_u64 = prefer_idle_read,
+ .write_u64 = prefer_idle_write,
+ },
{ } /* terminate */
};