#include <linux/sched/idle.h>
#include <linux/sched/topology.h>
-#ifdef CONFIG_SCHED_TUNE
-enum stune_group {
- STUNE_ROOT,
- STUNE_FOREGROUND,
- STUNE_BACKGROUND,
- STUNE_TOPAPP,
- STUNE_GROUP_COUNT,
-};
-#endif
-
struct gb_qos_request {
struct plist_node node;
char *name;
/* global boost */
extern void gb_qos_update_request(struct gb_qos_request *req, u32 new_value);
-/* prefer perf */
-extern void request_kernel_prefer_perf(int grp_idx, int enable);
-
/* task band */
extern void sync_band(struct task_struct *p, bool join);
extern void newbie_join_band(struct task_struct *newbie);
static inline void gb_qos_update_request(struct gb_qos_request *req, u32 new_value) { }
-static inline void request_kernel_prefer_perf(int grp_idx, int enable) { }
-
static inline void sync_band(struct task_struct *p, bool join) { }
static inline void newbie_join_band(struct task_struct *newbie) { }
static inline int alloc_bands(void)
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+enum stune_group {
+ STUNE_ROOT,
+ STUNE_FOREGROUND,
+ STUNE_BACKGROUND,
+ STUNE_TOPAPP,
+ STUNE_RT,
+ STUNE_GROUP_COUNT,
+};
+
+#ifdef CONFIG_SCHED_EMS
+/* prefer perf */
+extern int kernel_prefer_perf(int grp_idx);
+extern void request_kernel_prefer_perf(int grp_idx, int enable);
+#else
+static inline int kernel_prefer_perf(int grp_idx) { }
+static inline void request_kernel_prefer_perf(int grp_idx, int enable) { }
+#endif
obj-y += core.o pcf.o global_boost.o lbt.o ontime.o energy.o init_util.o band.o
+obj-y += service.o
obj-$(CONFIG_SCHED_TUNE) += st_addon.o
obj-$(CONFIG_FREQVAR_TUNE) += freqvar_tune.o
--- /dev/null
+/*
+ * Services for Exynos Mobile Scheduler
+ *
+ * Copyright (C) 2018 Samsung Electronics Co., Ltd
+ * Park Bumgyu <bumgyu.park@samsung.com>
+ */
+
+#include <linux/kobject.h>
+#include <linux/ems.h>
+
+/**********************************************************************
+ * Kernel Prefer Perf *
+ **********************************************************************/
+static atomic_t kernel_prefer_perf_req[STUNE_GROUP_COUNT];
+int kernel_prefer_perf(int grp_idx)
+{
+ if (grp_idx >= STUNE_GROUP_COUNT)
+ return -EINVAL;
+
+ return atomic_read(&kernel_prefer_perf_req[grp_idx]);
+}
+
+void request_kernel_prefer_perf(int grp_idx, int value)
+{
+ if (grp_idx >= STUNE_GROUP_COUNT)
+ return;
+
+ atomic_set(&kernel_prefer_perf_req[grp_idx], value);
+}
+
+static ssize_t show_prefer_perf(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ int i, ret = 0;
+
+ /* shows the prefer_perf value of all schedtune groups */
+ for (i = 0; i < STUNE_GROUP_COUNT; i++)
+ ret += snprintf(buf + ret, 10, "%d ", kernel_prefer_perf(i));
+
+ ret += snprintf(buf + ret, 10, "\n");
+
+ return ret;
+}
+
+static struct kobj_attribute prefer_perf_attr =
+__ATTR(kernel_prefer_perf, 0444, show_prefer_perf, NULL);
+
+static int __init init_service(void)
+{
+ int ret;
+
+ ret = sysfs_create_file(ems_kobj, &prefer_perf_attr.attr);
+ if (ret)
+ pr_err("%s: faile to create sysfs file\n", __func__);
+
+ return 0;
+}
+late_initcall(init_service);
return select_perf_cpu(p);
}
-int kernel_prefer_perf(int grp_idx);
-static ssize_t show_prefer_perf(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- int i, ret = 0;
-
- /* shows the prefer_perf value of all schedtune groups */
- for (i = 0; i < STUNE_GROUP_COUNT; i++)
- ret += snprintf(buf + ret, 10, "%d ", kernel_prefer_perf(i));
-
- ret += snprintf(buf + ret, 10, "\n");
-
- return ret;
-}
-
-static struct kobj_attribute prefer_perf_attr =
-__ATTR(kernel_prefer_perf, 0444, show_prefer_perf, NULL);
-
/**********************************************************************
* Prefer Idle *
**********************************************************************/
return select_idle_cpu(p);
}
-
-/**********************************************************************
- * Sysfs interface *
- **********************************************************************/
-static int __init init_st_addon_sysfs(void)
-{
- int ret;
-
- ret = sysfs_create_file(ems_kobj, &prefer_perf_attr.attr);
- if (ret)
- pr_err("%s: faile to create sysfs file\n", __func__);
-
- return 0;
-}
-late_initcall(init_st_addon_sysfs);
#include <linux/rcupdate.h>
#include <linux/slab.h>
#include <linux/ems.h>
+#include <linux/ems_service.h>
#include <trace/events/sched.h>
return prefer_idle;
}
-#ifdef CONFIG_SCHED_EMS
-static atomic_t kernel_prefer_perf_req[BOOSTGROUPS_COUNT];
-int kernel_prefer_perf(int grp_idx)
-{
- if (grp_idx >= BOOSTGROUPS_COUNT)
- return -EINVAL;
-
- return atomic_read(&kernel_prefer_perf_req[grp_idx]);
-}
-
-void request_kernel_prefer_perf(int grp_idx, int enable)
-{
- if (grp_idx >= BOOSTGROUPS_COUNT)
- return;
-
- if (enable)
- atomic_inc(&kernel_prefer_perf_req[grp_idx]);
- else
- BUG_ON(atomic_dec_return(&kernel_prefer_perf_req[grp_idx]) < 0);
-}
-#else
-static inline int kernel_prefer_perf(int grp_idx) { return 0; }
-#endif
-
int schedtune_prefer_perf(struct task_struct *p)
{
struct schedtune *st;