Loading Documentation/devicetree/bindings/scheduler/sched_hmp.txt 0 → 100644 +35 −0 Original line number Diff line number Diff line * HMP scheduler This file describes the bindings for an optional HMP scheduler node (/sched-hmp). Required properties: Optional properties: - boost-policy: The HMP scheduler has two types of task placement boost policies. (1) boost-on-big policy make use of all big CPUs up to their full capacity before using the little CPUs. This improves performance on true b.L systems where the big CPUs have higher efficiency compared to the little CPUs. (2) boost-on-all policy place the tasks on the CPU having the highest spare capacity. This policy is optimal for SMP like systems. The scheduler sets the boost policy to boost-on-big on systems which has CPUs of different efficiencies. However it is possible that CPUs of the same micro architecture to have slight difference in efficiency due to other factors like cache size. Selecting the boost-on-big policy based on relative difference in efficiency is not optimal on such systems. The boost-policy device tree property is introduced to specify the required boost type and it overrides the default selection of boost type in the scheduler. The possible values for this property are "boost-on-big" and "boost-on-all". Example: sched-hmp { boost-policy = "boost-on-all" } Documentation/scheduler/sched-hmp.txt +8 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ CONTENTS 8.8 sched_get_busy 8.9 sched_freq_alert 8.10 sched_set_boost 9. Device Tree bindings =============== 1. INTRODUCTION Loading Loading @@ -1447,3 +1448,10 @@ Logged when boost settings are being changed <task>-0 [004] d.h4 12700.711489: sched_set_boost: ref_count=1 - ref_count: A non-zero value indicates boost is in effect ======================== 9. Device Tree bindings ======================== The device tree bindings for the HMP scheduler are defined in Documentation/devicetree/bindings/sched/sched_hmp.txt kernel/sched/core.c +2 −0 Original line number Diff line number Diff line Loading @@ -7812,6 +7812,7 @@ void __init sched_init_smp(void) hotcpu_notifier(cpuset_cpu_inactive, CPU_PRI_CPUSET_INACTIVE); update_cluster_topology(); init_sched_hmp_boost_policy(); init_hrtick(); Loading Loading @@ -7860,6 +7861,7 @@ void __init sched_init(void) BUG_ON(num_possible_cpus() > BITS_PER_LONG); sched_hmp_parse_dt(); init_clusters(); #ifdef CONFIG_FAIR_GROUP_SCHED Loading kernel/sched/hmp.c +50 −6 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <linux/cpufreq.h> #include <linux/list_sort.h> #include <linux/syscore_ops.h> #include <linux/of.h> #include "sched.h" #include "core_ctl.h" Loading Loading @@ -225,6 +226,52 @@ fail: return ret; } /* * It is possible that CPUs of the same micro architecture can have slight * difference in the efficiency due to other factors like cache size. The * BOOST_ON_BIG policy may not be optimial for such systems. The required * boost policy can be specified via device tree to handle this. */ static int __read_mostly sched_boost_policy = SCHED_BOOST_NONE; /* * This should be called after clusters are populated and * the respective efficiency values are initialized. */ void init_sched_hmp_boost_policy(void) { /* * Initialize the boost type here if it is not passed from * device tree. */ if (sched_boost_policy == SCHED_BOOST_NONE) { if (max_possible_efficiency != min_possible_efficiency) sched_boost_policy = SCHED_BOOST_ON_BIG; else sched_boost_policy = SCHED_BOOST_ON_ALL; } } void sched_hmp_parse_dt(void) { struct device_node *sn; const char *boost_policy; if (!sched_enable_hmp) return; sn = of_find_node_by_path("/sched-hmp"); if (!sn) return; if (!of_property_read_string(sn, "boost-policy", &boost_policy)) { if (!strcmp(boost_policy, "boost-on-big")) sched_boost_policy = SCHED_BOOST_ON_BIG; else if (!strcmp(boost_policy, "boost-on-all")) sched_boost_policy = SCHED_BOOST_ON_ALL; } } unsigned int max_possible_efficiency = 1; unsigned int min_possible_efficiency = UINT_MAX; Loading Loading @@ -1169,12 +1216,9 @@ int task_load_will_fit(struct task_struct *p, u64 task_load, int cpu, enum sched_boost_type sched_boost_type(void) { if (sched_boost()) { if (min_possible_efficiency != max_possible_efficiency) return SCHED_BOOST_ON_BIG; else return SCHED_BOOST_ON_ALL; } if (sched_boost()) return sched_boost_policy; return SCHED_BOOST_NONE; } Loading kernel/sched/sched.h +4 −0 Original line number Diff line number Diff line Loading @@ -1399,6 +1399,8 @@ extern u64 cpu_upmigrate_discourage_read_u64(struct cgroup_subsys_state *css, struct cftype *cft); extern int cpu_upmigrate_discourage_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, u64 upmigrate_discourage); extern void sched_hmp_parse_dt(void); extern void init_sched_hmp_boost_policy(void); #else /* CONFIG_SCHED_HMP */ Loading Loading @@ -1589,6 +1591,8 @@ static inline void post_big_task_count_change(void) { } static inline void set_hmp_defaults(void) { } static inline void clear_reserved(int cpu) { } static inline void sched_hmp_parse_dt(void) {} static inline void init_sched_hmp_boost_policy(void) {} #define trace_sched_cpu_load(...) #define trace_sched_cpu_load_lb(...) Loading Loading
Documentation/devicetree/bindings/scheduler/sched_hmp.txt 0 → 100644 +35 −0 Original line number Diff line number Diff line * HMP scheduler This file describes the bindings for an optional HMP scheduler node (/sched-hmp). Required properties: Optional properties: - boost-policy: The HMP scheduler has two types of task placement boost policies. (1) boost-on-big policy make use of all big CPUs up to their full capacity before using the little CPUs. This improves performance on true b.L systems where the big CPUs have higher efficiency compared to the little CPUs. (2) boost-on-all policy place the tasks on the CPU having the highest spare capacity. This policy is optimal for SMP like systems. The scheduler sets the boost policy to boost-on-big on systems which has CPUs of different efficiencies. However it is possible that CPUs of the same micro architecture to have slight difference in efficiency due to other factors like cache size. Selecting the boost-on-big policy based on relative difference in efficiency is not optimal on such systems. The boost-policy device tree property is introduced to specify the required boost type and it overrides the default selection of boost type in the scheduler. The possible values for this property are "boost-on-big" and "boost-on-all". Example: sched-hmp { boost-policy = "boost-on-all" }
Documentation/scheduler/sched-hmp.txt +8 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ CONTENTS 8.8 sched_get_busy 8.9 sched_freq_alert 8.10 sched_set_boost 9. Device Tree bindings =============== 1. INTRODUCTION Loading Loading @@ -1447,3 +1448,10 @@ Logged when boost settings are being changed <task>-0 [004] d.h4 12700.711489: sched_set_boost: ref_count=1 - ref_count: A non-zero value indicates boost is in effect ======================== 9. Device Tree bindings ======================== The device tree bindings for the HMP scheduler are defined in Documentation/devicetree/bindings/sched/sched_hmp.txt
kernel/sched/core.c +2 −0 Original line number Diff line number Diff line Loading @@ -7812,6 +7812,7 @@ void __init sched_init_smp(void) hotcpu_notifier(cpuset_cpu_inactive, CPU_PRI_CPUSET_INACTIVE); update_cluster_topology(); init_sched_hmp_boost_policy(); init_hrtick(); Loading Loading @@ -7860,6 +7861,7 @@ void __init sched_init(void) BUG_ON(num_possible_cpus() > BITS_PER_LONG); sched_hmp_parse_dt(); init_clusters(); #ifdef CONFIG_FAIR_GROUP_SCHED Loading
kernel/sched/hmp.c +50 −6 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <linux/cpufreq.h> #include <linux/list_sort.h> #include <linux/syscore_ops.h> #include <linux/of.h> #include "sched.h" #include "core_ctl.h" Loading Loading @@ -225,6 +226,52 @@ fail: return ret; } /* * It is possible that CPUs of the same micro architecture can have slight * difference in the efficiency due to other factors like cache size. The * BOOST_ON_BIG policy may not be optimial for such systems. The required * boost policy can be specified via device tree to handle this. */ static int __read_mostly sched_boost_policy = SCHED_BOOST_NONE; /* * This should be called after clusters are populated and * the respective efficiency values are initialized. */ void init_sched_hmp_boost_policy(void) { /* * Initialize the boost type here if it is not passed from * device tree. */ if (sched_boost_policy == SCHED_BOOST_NONE) { if (max_possible_efficiency != min_possible_efficiency) sched_boost_policy = SCHED_BOOST_ON_BIG; else sched_boost_policy = SCHED_BOOST_ON_ALL; } } void sched_hmp_parse_dt(void) { struct device_node *sn; const char *boost_policy; if (!sched_enable_hmp) return; sn = of_find_node_by_path("/sched-hmp"); if (!sn) return; if (!of_property_read_string(sn, "boost-policy", &boost_policy)) { if (!strcmp(boost_policy, "boost-on-big")) sched_boost_policy = SCHED_BOOST_ON_BIG; else if (!strcmp(boost_policy, "boost-on-all")) sched_boost_policy = SCHED_BOOST_ON_ALL; } } unsigned int max_possible_efficiency = 1; unsigned int min_possible_efficiency = UINT_MAX; Loading Loading @@ -1169,12 +1216,9 @@ int task_load_will_fit(struct task_struct *p, u64 task_load, int cpu, enum sched_boost_type sched_boost_type(void) { if (sched_boost()) { if (min_possible_efficiency != max_possible_efficiency) return SCHED_BOOST_ON_BIG; else return SCHED_BOOST_ON_ALL; } if (sched_boost()) return sched_boost_policy; return SCHED_BOOST_NONE; } Loading
kernel/sched/sched.h +4 −0 Original line number Diff line number Diff line Loading @@ -1399,6 +1399,8 @@ extern u64 cpu_upmigrate_discourage_read_u64(struct cgroup_subsys_state *css, struct cftype *cft); extern int cpu_upmigrate_discourage_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, u64 upmigrate_discourage); extern void sched_hmp_parse_dt(void); extern void init_sched_hmp_boost_policy(void); #else /* CONFIG_SCHED_HMP */ Loading Loading @@ -1589,6 +1591,8 @@ static inline void post_big_task_count_change(void) { } static inline void set_hmp_defaults(void) { } static inline void clear_reserved(int cpu) { } static inline void sched_hmp_parse_dt(void) {} static inline void init_sched_hmp_boost_policy(void) {} #define trace_sched_cpu_load(...) #define trace_sched_cpu_load_lb(...) Loading