|
@@ -6004,7 +6004,7 @@ unsigned long __weak arch_scale_cpu_capacity(struct sched_domain *sd, int cpu)
|
|
|
static unsigned long scale_rt_capacity(int cpu)
|
|
|
{
|
|
|
struct rq *rq = cpu_rq(cpu);
|
|
|
- u64 total, available, age_stamp, avg;
|
|
|
+ u64 total, used, age_stamp, avg;
|
|
|
s64 delta;
|
|
|
|
|
|
/*
|
|
@@ -6020,19 +6020,12 @@ static unsigned long scale_rt_capacity(int cpu)
|
|
|
|
|
|
total = sched_avg_period() + delta;
|
|
|
|
|
|
- if (unlikely(total < avg)) {
|
|
|
- /* Ensures that capacity won't end up being negative */
|
|
|
- available = 0;
|
|
|
- } else {
|
|
|
- available = total - avg;
|
|
|
- }
|
|
|
+ used = div_u64(avg, total);
|
|
|
|
|
|
- if (unlikely((s64)total < SCHED_CAPACITY_SCALE))
|
|
|
- total = SCHED_CAPACITY_SCALE;
|
|
|
+ if (likely(used < SCHED_CAPACITY_SCALE))
|
|
|
+ return SCHED_CAPACITY_SCALE - used;
|
|
|
|
|
|
- total >>= SCHED_CAPACITY_SHIFT;
|
|
|
-
|
|
|
- return div_u64(available, total);
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
static void update_cpu_capacity(struct sched_domain *sd, int cpu)
|