From 196711ecb908db3d51ef5f6cfbfeb0b397f6598c Mon Sep 17 00:00:00 2001 From: Park Bumgyu Date: Thu, 22 Mar 2018 14:43:33 +0900 Subject: [PATCH] sched: change exynos scheduler name from EHMP to EMS Rename Exynos scheduler. Existing EHMP(Exynos HMP) was a scheduler considering only HMP chipset. EMS(Exynos Mobile Scheduler) will support all chipsets regardless of cluster and core configuration. Change-Id: I2802ddcd9e401a0d92f9c98656b5e591d429d6ce Signed-off-by: Park Bumgyu --- drivers/cpufreq/Kconfig | 3 +-- include/linux/{ehmp.h => ems.h} | 10 +++++----- include/linux/sched.h | 4 ---- include/trace/events/{ehmp.h => ems.h} | 8 ++++---- init/Kconfig | 14 +++++++------- kernel/sched/Makefile | 2 +- kernel/sched/ems/Makefile | 2 +- kernel/sched/ems/ehmp.c | 4 ++-- kernel/sched/ems/ems.h | 12 ++++++++++++ kernel/sched/fair.c | 16 ++++++++-------- kernel/sched/features.h | 6 +----- kernel/sched/sched.h | 2 +- kernel/sched/tune.c | 4 ++-- 13 files changed, 45 insertions(+), 42 deletions(-) rename include/linux/{ehmp.h => ems.h} (92%) rename include/trace/events/{ehmp.h => ems.h} (98%) create mode 100644 kernel/sched/ems/ems.h diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 8c409edac140..efe920aa0df9 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -190,7 +190,6 @@ config CPU_FREQ_GOV_SCHEDUTIL depends on CPU_FREQ && SMP select CPU_FREQ_GOV_ATTR_SET select IRQ_WORK - select FREQVAR_TUNE help This governor makes decisions based on the utilization data provided by the scheduler. It sets the CPU frequency to be proportional to @@ -205,7 +204,7 @@ config CPU_FREQ_GOV_SCHEDUTIL config FREQVAR_TUNE bool "CPU frequency variant tuner" - depends on CPU_FREQ_GOV_SCHEDUTIL + depends on SCHED_EMS && CPU_FREQ_GOV_SCHEDUTIL help This option provides the controller which tunes system performance as frequency variant. diff --git a/include/linux/ehmp.h b/include/linux/ems.h similarity index 92% rename from include/linux/ehmp.h rename to include/linux/ems.h index 5633347a4f37..d019bbec826a 100644 --- a/include/linux/ehmp.h +++ b/include/linux/ems.h @@ -30,7 +30,7 @@ struct gb_qos_request { bool active; }; -#ifdef CONFIG_SCHED_EHMP +#ifdef CONFIG_SCHED_EMS extern int exynos_estimate_idle_state(int cpu_idx, struct cpumask *mask, int state, int cpus); extern struct sched_group *exynos_fit_idlest_group(struct sched_domain *sd, @@ -72,8 +72,8 @@ static inline int exynos_need_active_balance(enum cpu_idle_type idle, static inline unsigned long global_boost(void) { return 0; } static inline int find_second_max_cap(void) { return -EINVAL; } -static inline int exynos_select_cpu(struct task_struct *p, int prev_cpu, - int sync, int sd_flag) { return -EINVAL; } +static inline int exynos_select_cpu(struct task_struct *p, int *backup_cpu, + bool boosted, bool prefer_idle) { return -EINVAL; } static inline void ontime_migration(void) { } static inline int ontime_can_migration(struct task_struct *p, int cpu) { return 1; } @@ -90,5 +90,5 @@ static inline void update_lbt_overutil(int cpu, unsigned long capacity) { } static inline void gb_qos_update_request(struct gb_qos_request *req, u32 new_value) { } -//extern void request_kernel_prefer_perf(int grp_idx, int enable) { } -#endif /* CONFIG_SCHED_EHMP */ +static inline void request_kernel_prefer_perf(int grp_idx, int enable) { } +#endif /* CONFIG_SCHED_EMS */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 03caa8b1cd4f..7d11d7455566 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -347,7 +347,6 @@ struct sched_avg { unsigned long util_avg; }; -#ifdef CONFIG_SCHED_EHMP #define NOT_ONTIME 1 #define ONTIME_MIGRATING 2 #define ONTIME 4 @@ -366,7 +365,6 @@ struct ontime_entity { int flags; int cpu; }; -#endif struct sched_statistics { #ifdef CONFIG_SCHEDSTATS @@ -438,9 +436,7 @@ struct sched_entity { */ struct sched_avg avg ____cacheline_aligned_in_smp; #endif -#ifdef CONFIG_SCHED_EHMP struct ontime_entity ontime; -#endif }; #ifdef CONFIG_SCHED_WALT diff --git a/include/trace/events/ehmp.h b/include/trace/events/ems.h similarity index 98% rename from include/trace/events/ehmp.h rename to include/trace/events/ems.h index 6c9878a9524e..49598ef75624 100644 --- a/include/trace/events/ehmp.h +++ b/include/trace/events/ems.h @@ -7,10 +7,10 @@ */ #undef TRACE_SYSTEM -#define TRACE_SYSTEM ehmp +#define TRACE_SYSTEM ems -#if !defined(_TRACE_EHMP_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_EHMP_H +#if !defined(_TRACE_EMS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_EMS_H #include #include @@ -388,7 +388,7 @@ TRACE_EVENT(ehmp_lbt_overutilized, __entry->capacity, __entry->overutilized) ); -#endif /* _TRACE_EHMP_H */ +#endif /* _TRACE_EMS_H */ /* This part must be outside protection */ #include diff --git a/init/Kconfig b/init/Kconfig index f22ccf30851a..7872c3630069 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -991,15 +991,15 @@ config SCHED_TUNE If unsure, say N. -config SCHED_EHMP - bool "Exynos scheduler for Heterogeneous Multi-Processor" +config SCHED_EMS + bool "Exynos Mobile Scheduler" depends on SMP help - This option supports Exynos scheduler for HMP architecture. It is - designed to secure the limits of energy aware scheduler. This option - provides features such as independent boosting functinos such as - global boost and on-time migration, and prefer_perf and enhanced - prefer_idle that work in conjunction with SCHEDTUNE. + This option supports Exynos mobile scheduler. It is designed to + secure the limits of energy aware scheduler. This option provides + features such as independent boosting functinos such as on-time migration, + and prefer_perf and enhanced prefer_idle that work in conjunction with + SCHEDTUNE. If unsure, say N. diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile index f8b8b5152868..c4b9f40b147c 100644 --- a/kernel/sched/Makefile +++ b/kernel/sched/Makefile @@ -30,4 +30,4 @@ obj-$(CONFIG_CGROUP_CPUACCT) += cpuacct.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) += cpufreq_schedutil.o obj-$(CONFIG_MEMBARRIER) += membarrier.o -obj-$(CONFIG_SCHED_EHMP) += ems/ +obj-$(CONFIG_SCHED_EMS) += ems/ diff --git a/kernel/sched/ems/Makefile b/kernel/sched/ems/Makefile index f2b1f7be7905..5a981b8e53c4 100644 --- a/kernel/sched/ems/Makefile +++ b/kernel/sched/ems/Makefile @@ -1,2 +1,2 @@ -obj-$(CONFIG_SCHED_EHMP) += ehmp.o +obj-$(CONFIG_SCHED_EMS) += ehmp.o obj-$(CONFIG_FREQVAR_TUNE) += freqvar_tune.o diff --git a/kernel/sched/ems/ehmp.c b/kernel/sched/ems/ehmp.c index 01f64b0628a6..7368f61a28f6 100644 --- a/kernel/sched/ems/ehmp.c +++ b/kernel/sched/ems/ehmp.c @@ -8,11 +8,11 @@ #include #include #include -#include +#include #include #define CREATE_TRACE_POINTS -#include +#include #include "../sched.h" #include "../tune.h" diff --git a/kernel/sched/ems/ems.h b/kernel/sched/ems/ems.h new file mode 100644 index 000000000000..1ad0eb098216 --- /dev/null +++ b/kernel/sched/ems/ems.h @@ -0,0 +1,12 @@ +/* + * 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. + */ diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ec584ec4935c..98681cdc9878 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include @@ -796,7 +796,7 @@ void post_init_entity_util_avg(struct sched_entity *se) struct sched_avg *sa = &se->avg; long cap = (long)(SCHED_CAPACITY_SCALE - cfs_rq->avg.util_avg) / 2; - if (sched_feat(EXYNOS_HMP)) { + if (sched_feat(EXYNOS_MS)) { exynos_init_entity_util_avg(se); goto util_init_done; } @@ -4975,7 +4975,7 @@ static inline void update_overutilized_status(struct rq *rq) rcu_read_lock(); sd = rcu_dereference(rq->sd); if (sd && !sd_overutilized(sd)) { - if (sched_feat(EXYNOS_HMP)) + if (sched_feat(EXYNOS_MS)) overutilized = lbt_overutilized(rq->cpu, sd->level); else overutilized = cpu_overutilized(rq->cpu); @@ -5713,7 +5713,7 @@ static int group_idle_state(struct energy_env *eenv, int cpu_idx) * after moving, previous cpu/cluster can be powered down, * so it should be consider it when idle power was calculated. */ - if (sched_feat(EXYNOS_HMP)) { + if (sched_feat(EXYNOS_MS)) { new_state = exynos_estimate_idle_state(cpu_idx, sched_group_span(sg), max_idle_state_idx, sg->group_weight); if (new_state) @@ -6287,7 +6287,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, unsigned long imbalance = scale_load_down(NICE_0_LOAD) * (sd->imbalance_pct-100) / 100; - if (sched_feat(EXYNOS_HMP)) { + if (sched_feat(EXYNOS_MS)) { idlest = exynos_fit_idlest_group(sd, p); if (idlest) return idlest; @@ -7337,7 +7337,7 @@ static int find_energy_efficient_cpu(struct sched_domain *sd, eenv->max_cpu_count = EAS_CPU_BKP + 1; /* Find a cpu with sufficient capacity */ - if (sched_feat(EXYNOS_HMP)) { + if (sched_feat(EXYNOS_MS)) { eenv->cpu[EAS_CPU_NXT].cpu_id = exynos_select_cpu(p, &eenv->cpu[EAS_CPU_BKP].cpu_id, boosted, prefer_idle); @@ -9037,7 +9037,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, !sgs->group_misfit_task && rq_has_misfit(rq)) sgs->group_misfit_task = capacity_of(i); - if (sched_feat(EXYNOS_HMP)) { + if (sched_feat(EXYNOS_MS)) { if (lbt_overutilized(i, env->sd->level)) { *overutilized = true; @@ -9754,7 +9754,7 @@ static int need_active_balance(struct lb_env *env) return 1; } - if (sched_feat(EXYNOS_HMP)) + if (sched_feat(EXYNOS_MS)) return exynos_need_active_balance(env->idle, sd, env->src_cpu, env->dst_cpu); /* diff --git a/kernel/sched/features.h b/kernel/sched/features.h index 524fdaee4932..738f5914a6b6 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -114,8 +114,4 @@ SCHED_FEAT(EAS_PREFER_IDLE, true) SCHED_FEAT(FIND_BEST_TARGET, true) SCHED_FEAT(FBT_STRICT_ORDER, true) -#ifdef CONFIG_SCHED_EHMP -SCHED_FEAT(EXYNOS_HMP, true) -#else -SCHED_FEAT(EXYNOS_HMP, false) -#endif +SCHED_FEAT(EXYNOS_MS, true) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 0cab9df5f390..f41f94c00bc3 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -841,7 +841,7 @@ struct rq { u64 cum_window_demand; #endif /* CONFIG_SCHED_WALT */ -#ifdef CONFIG_SCHED_EHMP +#ifdef CONFIG_SCHED_EMS bool ontime_migrating; #endif diff --git a/kernel/sched/tune.c b/kernel/sched/tune.c index 94d5a7140bd3..e9f212d59578 100644 --- a/kernel/sched/tune.c +++ b/kernel/sched/tune.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include @@ -435,7 +435,7 @@ int schedtune_prefer_idle(struct task_struct *p) return prefer_idle; } -#ifdef CONFIG_SCHED_EHMP +#ifdef CONFIG_SCHED_EMS static atomic_t kernel_prefer_perf_req[BOOSTGROUPS_COUNT]; int kernel_prefer_perf(int grp_idx) { -- 2.20.1