From aa6ed255a2e2117c6f24134c8bf4294f0ad49837 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 73a02fece874..d388f71fa1db 100644 --- a/kernel/sched/tune.c +++ b/kernel/sched/tune.c @@ -79,6 +79,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) @@ -411,6 +414,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; @@ -759,6 +779,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) { @@ -874,6 +912,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