/**********************************************************************
* task initialization *
**********************************************************************/
-void exynos_init_entity_util_avg(struct sched_entity *se)
+enum {
+ TYPE_BASE_CFS_RQ_UTIL = 0,
+ TYPE_BASE_INHERIT_PARENT_UTIL,
+ TYPE_MAX_NUM,
+};
+
+static unsigned long init_util_type = TYPE_BASE_CFS_RQ_UTIL;
+static unsigned long init_util_ratio = 25; /* 25% */
+
+static ssize_t show_initial_util_type(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return snprintf(buf, 10, "%ld\n", init_util_type);
+}
+
+static ssize_t store_initial_util_type(struct kobject *kobj,
+ struct kobj_attribute *attr, const char *buf,
+ size_t count)
+{
+ long input;
+
+ if (!sscanf(buf, "%ld", &input))
+ return -EINVAL;
+
+ input = input < 0 ? 0 : input;
+ input = input >= TYPE_MAX_NUM ? TYPE_MAX_NUM - 1 : input;
+
+ init_util_type = input;
+
+ return count;
+}
+
+static ssize_t show_initial_util_ratio(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return snprintf(buf, 10, "%ld\n", init_util_ratio);
+}
+
+static ssize_t store_initial_util_ratio(struct kobject *kobj,
+ struct kobj_attribute *attr, const char *buf,
+ size_t count)
+{
+ long input;
+
+ if (!sscanf(buf, "%ld", &input))
+ return -EINVAL;
+
+ init_util_ratio = !!input;
+
+ return count;
+}
+
+static struct kobj_attribute initial_util_type =
+__ATTR(initial_util_type, 0644, show_initial_util_type, store_initial_util_type);
+
+static struct kobj_attribute initial_util_ratio =
+__ATTR(initial_util_ratio, 0644, show_initial_util_ratio, store_initial_util_ratio);
+
+void base_cfs_rq_util(struct sched_entity *se)
{
struct cfs_rq *cfs_rq = se->cfs_rq;
struct sched_avg *sa = &se->avg;
if (sa->util_avg > cap)
sa->util_avg = cap;
} else {
- sa->util_avg = cap_org >> 2;
+ sa->util_avg = cap_org * init_util_ratio / 100;
}
/*
* If we wish to restore tuning via setting initial util,
}
}
+void base_inherit_parent_util(struct sched_entity *se)
+{
+ struct sched_avg *sa = &se->avg;
+ struct task_struct *p = current;
+
+ sa->util_avg = p->se.avg.util_avg;
+ sa->util_sum = p->se.avg.util_sum;
+}
+
+void exynos_init_entity_util_avg(struct sched_entity *se)
+{
+ int type = init_util_type;
+
+ switch(type) {
+ case TYPE_BASE_CFS_RQ_UTIL:
+ base_cfs_rq_util(se);
+ break;
+ case TYPE_BASE_INHERIT_PARENT_UTIL:
+ base_inherit_parent_util(se);
+ break;
+ default:
+ pr_info("%s: Not support initial util type %ld\n",
+ __func__, init_util_type);
+ }
+}
+
/**********************************************************************
* load balance *
**********************************************************************/
&top_overutil_attr.attr,
&bot_overutil_attr.attr,
&prefer_perf_attr.attr,
+ &initial_util_type.attr,
+ &initial_util_ratio.attr,
NULL,
};