From 7881d18789fe9c126429010704725307e6c6caf6 Mon Sep 17 00:00:00 2001 From: "lakkyung.jung" Date: Fri, 4 May 2018 10:20:03 +0900 Subject: [PATCH] sched: tune: Add utilest interface to schedtune. Change-Id: I4e5313f7128f5aa599b7214eaf13679d1f9484ef Signed-off-by: lakkyung.jung --- kernel/sched/tune.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/kernel/sched/tune.c b/kernel/sched/tune.c index b30d979343c1..18ed6d5abde4 100644 --- a/kernel/sched/tune.c +++ b/kernel/sched/tune.c @@ -82,6 +82,9 @@ struct schedtune { /* SchedTune group balancer */ struct group_balancer gb; + + /* SchedTune util-est */ + int util_est_en; }; static inline struct schedtune *css_st(struct cgroup_subsys_state *css) @@ -473,6 +476,23 @@ int schedtune_task_boost(struct task_struct *p) return task_boost; } +int schedtune_util_est_en(struct task_struct *p) +{ + struct schedtune *st; + int util_est_en; + + if (unlikely(!schedtune_initialized)) + return 0; + + /* Get util_est value */ + rcu_read_lock(); + st = task_schedtune(p); + util_est_en = st->util_est_en; + rcu_read_unlock(); + + return util_est_en; +} + int schedtune_prefer_idle(struct task_struct *p) { struct schedtune *st; @@ -821,6 +841,24 @@ gb_window_write(struct cgroup_subsys_state *css, struct cftype *cft, return 0; } +static u64 +util_est_en_read(struct cgroup_subsys_state *css, struct cftype *cft) +{ + struct schedtune *st = css_st(css); + + return st->util_est_en; +} + +static int +util_est_en_write(struct cgroup_subsys_state *css, struct cftype *cft, + u64 util_est_en) +{ + struct schedtune *st = css_st(css); + st->util_est_en = util_est_en; + + return 0; +} + static u64 prefer_idle_read(struct cgroup_subsys_state *css, struct cftype *cft) { @@ -936,6 +974,11 @@ static struct cftype files[] = { .read_u64 = gb_window_read, .write_u64 = gb_window_write, }, + { + .name = "util_est_en", + .read_u64 = util_est_en_read, + .write_u64 = util_est_en_write, + }, { } /* terminate */ }; -- 2.20.1