diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6b3b59cc51d6c..f71e8b0e0346a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6586,7 +6586,8 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) util = cpu_util_next(cpu, p, cpu); cpu_cap = capacity_of(cpu); - spare_cap = cpu_cap - util; + spare_cap = cpu_cap; + lsub_positive(&spare_cap, util); /* * Skip CPUs that cannot satisfy the capacity request.