Loading kernel/sched/fair.c +23 −3 Original line number Diff line number Diff line Loading @@ -2308,6 +2308,8 @@ static int lower_power_cpu_available(struct task_struct *p, int cpu) return (lowest_power_cpu != task_cpu(p)); } static inline int is_cpu_throttling_imminent(int cpu); /* * Check if a task is on the "wrong" cpu (i.e its current cpu is not the ideal * cpu as per its demand or priority) Loading Loading @@ -2340,6 +2342,7 @@ static inline int migration_needed(struct rq *rq, struct task_struct *p) return MOVE_TO_BIG_CPU; if (sched_enable_power_aware && is_cpu_throttling_imminent(cpu_of(rq)) && lower_power_cpu_available(p, cpu_of(rq))) return MOVE_TO_POWER_EFFICIENT_CPU; Loading Loading @@ -2403,6 +2406,16 @@ static inline int nr_big_tasks(struct rq *rq) return rq->nr_big_tasks; } static inline int is_cpu_throttling_imminent(int cpu) { int throttling = 0; struct cpu_pwr_stats *per_cpu_info = get_cpu_pwr_stats(); if (per_cpu_info) throttling = per_cpu_info[cpu].throttling; return throttling; } #else /* CONFIG_SCHED_HMP */ #define sched_enable_power_aware 0 Loading Loading @@ -2459,6 +2472,11 @@ static inline int nr_big_tasks(struct rq *rq) return 0; } static inline int is_cpu_throttling_imminent(int cpu) { return 0; } #endif /* CONFIG_SCHED_HMP */ #ifdef CONFIG_SCHED_HMP Loading Loading @@ -6078,12 +6096,14 @@ static bool update_sd_pick_busiest(struct lb_env *env, } /* Mark a less power-efficient CPU as busy only if we haven't * seen a busy group yet. We want to prioritize spreading * work over power optimization. */ * seen a busy group yet and we are close to throttling. We want to * prioritize spreading work over power optimization. */ if (!sds->busiest && (capacity(env->dst_rq) == group_rq_capacity(sg)) && sgs->sum_nr_running && (env->idle != CPU_NOT_IDLE) && power_cost_at_freq(env->dst_cpu, 0) < power_cost_at_freq(cpumask_first(sched_group_cpus(sg)), 0)) { power_cost_at_freq(cpumask_first(sched_group_cpus(sg)), 0) && is_cpu_throttling_imminent(cpumask_first(sched_group_cpus(sg)))) { env->flags |= LBF_PWR_ACTIVE_BALANCE; return true; } Loading Loading
kernel/sched/fair.c +23 −3 Original line number Diff line number Diff line Loading @@ -2308,6 +2308,8 @@ static int lower_power_cpu_available(struct task_struct *p, int cpu) return (lowest_power_cpu != task_cpu(p)); } static inline int is_cpu_throttling_imminent(int cpu); /* * Check if a task is on the "wrong" cpu (i.e its current cpu is not the ideal * cpu as per its demand or priority) Loading Loading @@ -2340,6 +2342,7 @@ static inline int migration_needed(struct rq *rq, struct task_struct *p) return MOVE_TO_BIG_CPU; if (sched_enable_power_aware && is_cpu_throttling_imminent(cpu_of(rq)) && lower_power_cpu_available(p, cpu_of(rq))) return MOVE_TO_POWER_EFFICIENT_CPU; Loading Loading @@ -2403,6 +2406,16 @@ static inline int nr_big_tasks(struct rq *rq) return rq->nr_big_tasks; } static inline int is_cpu_throttling_imminent(int cpu) { int throttling = 0; struct cpu_pwr_stats *per_cpu_info = get_cpu_pwr_stats(); if (per_cpu_info) throttling = per_cpu_info[cpu].throttling; return throttling; } #else /* CONFIG_SCHED_HMP */ #define sched_enable_power_aware 0 Loading Loading @@ -2459,6 +2472,11 @@ static inline int nr_big_tasks(struct rq *rq) return 0; } static inline int is_cpu_throttling_imminent(int cpu) { return 0; } #endif /* CONFIG_SCHED_HMP */ #ifdef CONFIG_SCHED_HMP Loading Loading @@ -6078,12 +6096,14 @@ static bool update_sd_pick_busiest(struct lb_env *env, } /* Mark a less power-efficient CPU as busy only if we haven't * seen a busy group yet. We want to prioritize spreading * work over power optimization. */ * seen a busy group yet and we are close to throttling. We want to * prioritize spreading work over power optimization. */ if (!sds->busiest && (capacity(env->dst_rq) == group_rq_capacity(sg)) && sgs->sum_nr_running && (env->idle != CPU_NOT_IDLE) && power_cost_at_freq(env->dst_cpu, 0) < power_cost_at_freq(cpumask_first(sched_group_cpus(sg)), 0)) { power_cost_at_freq(cpumask_first(sched_group_cpus(sg)), 0) && is_cpu_throttling_imminent(cpumask_first(sched_group_cpus(sg)))) { env->flags |= LBF_PWR_ACTIVE_BALANCE; return true; } Loading