sched/fair: fix implementation of is_min_capacity_cpu()

With CONFIG_SCHED_WALT disabled, is_min_capacity_cpu() is defined to
always return true, which breaks the intended behavior of
task_fits_max(). Revise is_min_capacity_cpu() to return correct
results.

An earlier version of this patch failed to handle the case when
min_cap_orig_cpu == -1 while sched domains are being updated due to
hotplug. Add a check for this case.

Test: trace shows increased top-app placement on medium cores
Bug: 117499098
Bug: 128477368
Bug: 130756111
Change-Id: Ia2b41aa7c57f071c997bcd0e9cdfd0808f6a2bf9
Signed-off-by: Connor O'Brien <connoro@google.com>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
fourteen
Connor O'Brien 6 years ago committed by Jenna
parent 0109786a13
commit 295f1a8a53
  1. 12
      kernel/sched/sched.h

@ -3054,7 +3054,17 @@ task_in_cum_window_demand(struct rq *rq, struct task_struct *p)
static inline bool hmp_capable(void) { return false; }
static inline bool is_max_capacity_cpu(int cpu) { return true; }
static inline bool is_min_capacity_cpu(int cpu) { return true; }
static inline bool is_min_capacity_cpu(int cpu)
{
#ifdef CONFIG_SMP
int min_cpu = cpu_rq(cpu)->rd->min_cap_orig_cpu;
return unlikely(min_cpu == -1) ||
capacity_orig_of(cpu) == capacity_orig_of(min_cpu);
#else
return true;
#endif
}
static inline int
preferred_cluster(struct sched_cluster *cluster, struct task_struct *p)

Loading…
Cancel
Save