Instead of calculating how many (logical) CPUs to scan, compute how many cores to scan. This changes behaviour for anything !SMT2. Signed-off-by: Peter Zijlstra (Intel) --- kernel/sched/fair.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6352,6 +6352,8 @@ static int select_idle_smt(struct task_s #else /* CONFIG_SCHED_SMT */ +#define sched_smt_weight 1 + static inline int select_idle_core(struct task_struct *p, struct sched_domain *sd, int target) { return -1; @@ -6381,6 +6383,8 @@ static int __select_idle_cpu(struct task return cpu; } +#define sis_min_cores 2 + /* * Scan the LLC domain for idle CPUs; this is dynamically regulated by * comparing the average scan cost (tracked in sd->avg_scan_cost) against the @@ -6429,15 +6433,15 @@ static int select_idle_cpu(struct task_s if (sched_feat(SIS_PROP)) { u64 span_avg = sd->span_weight * avg_idle; - if (span_avg > 4*avg_cost) + if (span_avg > sis_min_cores * avg_cost) nr = div_u64(span_avg, avg_cost); else - nr = 4; + nr = sis_min_cores; } time = local_clock(); - cpu = __select_idle_cpu(p, sd, target, nr, &loops); + cpu = __select_idle_cpu(p, sd, target, nr * sched_smt_weight, &loops); time = local_clock() - time;