From 76e19fdf8e8389fc28e3a77cc782ed01a36f1453 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Mon, 9 Dec 2019 16:08:30 +0000 Subject: [PATCH] ANDROID: sched/fair: Fix 5.5-rc1 merge Some android-specific EAS patches caused issues during the 5.5-rc1 merge that contains the load-balance rework. Most of the issues these patches were fixing should now covered by the rework, which means they are not needed any more. And for the others, they need to be reworked to fit with the new LB code. Fix the 5.5-rc1 merge by removing all the android-specific code from the load balancer. Effectively, this reverts 65b8ddef4ef0 ("ANDROID: sched: Prevent unnecessary active balance of single task in sched group"), f351885fc72a ("ANDROID: sched/fair: Attempt to improve throughput for asym cap systems"), a7455f812347 ("ANDROID: sched/fair: Don't balance misfits if it would overload local group") and 44ab1611a8fa ("ANDROID: sched/fair: Also do misfit in overloaded groups"). Fixes: d3a196a37197 ("Merge 5.5-rc1 into android-mainline") Change-Id: I15c2e044d9f571be5eac0ced929690d9bf7dec65 Signed-off-by: Quentin Perret --- kernel/sched/fair.c | 73 ++------------------------------------------- 1 file changed, 2 insertions(+), 71 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5fc60219b6a8..60ad153716a0 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7105,7 +7105,6 @@ struct lb_env { int new_dst_cpu; enum cpu_idle_type idle; long imbalance; - unsigned int src_grp_nr_running; /* The set of CPUs under consideration for load-balancing */ struct cpumask *cpus; @@ -8670,8 +8669,6 @@ next_group: if (env->sd->flags & SD_NUMA) env->fbq_type = fbq_classify_group(&sds->busiest_stat); - env->src_grp_nr_running = sds->busiest_stat.sum_nr_running; - if (!env->sd->parent) { struct root_domain *rd = env->dst_rq->rd; @@ -8752,54 +8749,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s env->migration_type = migrate_util; env->imbalance = max(local->group_capacity, local->group_util) - local->group_util; -#if 0 -<<<<<<< HEAD - capa_now += busiest->group_capacity * - min(busiest->load_per_task, busiest->avg_load); - capa_now += local->group_capacity * - min(local->load_per_task, local->avg_load); - capa_now /= SCHED_CAPACITY_SCALE; - /* Amount of load we'd subtract */ - if (busiest->avg_load > scaled_busy_load_per_task) { - capa_move += busiest->group_capacity * - min(busiest->load_per_task, - busiest->avg_load - scaled_busy_load_per_task); - } - - /* Amount of load we'd add */ - if (busiest->avg_load * busiest->group_capacity < - busiest->load_per_task * SCHED_CAPACITY_SCALE) { - tmp = (busiest->avg_load * busiest->group_capacity) / - local->group_capacity; - } else { - tmp = (busiest->load_per_task * SCHED_CAPACITY_SCALE) / - local->group_capacity; - } - capa_move += local->group_capacity * - min(local->load_per_task, local->avg_load + tmp); - capa_move /= SCHED_CAPACITY_SCALE; - - /* Move if we gain throughput */ - if (capa_move > capa_now) { - env->imbalance = busiest->load_per_task; - return; - } - - /* We can't see throughput improvement with the load-based - * method, but it is possible depending upon group size and - * capacity range that there might still be an underutilized - * cpu available in an asymmetric capacity system. Do one last - * check just in case. - */ - if (env->sd->flags & SD_ASYM_CPUCAPACITY && - busiest->group_type == group_overloaded && - busiest->sum_nr_running > busiest->group_weight && - local->sum_nr_running < local->group_weight && - local->group_capacity < busiest->group_capacity) - env->imbalance = busiest->load_per_task; -} -======= /* * In some cases, the group's utilization is max or even * higher than capacity because of migrations but the @@ -8811,8 +8761,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s env->migration_type = migrate_task; env->imbalance = 1; } ->>>>>>> v5.5-rc1 -#endif + return; } @@ -8868,23 +8817,6 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s (busiest->avg_load - sds->avg_load) * busiest->group_capacity, (sds->avg_load - local->avg_load) * local->group_capacity ) / SCHED_CAPACITY_SCALE; - - /* Boost imbalance to allow misfit task to be balanced. - * Always do this if we are doing a NEWLY_IDLE balance - * on the assumption that any tasks we have must not be - * long-running (and hence we cannot rely upon load). - * However if we are not idle, we should assume the tasks - * we have are longer running and not override load-based - * calculations above unless we are sure that the local - * group is underutilized. - */ - if (busiest->group_type == group_misfit_task && - (env->idle == CPU_NEWLY_IDLE || - local->sum_nr_running < local->group_weight)) { - env->imbalance = max_t(long, env->imbalance, - busiest->group_misfit_task_load); - } - } /******* find_busiest_group() helpers end here *********************/ @@ -9437,8 +9369,7 @@ more_balance: * excessive cache_hot migrations and active balances. */ if (idle != CPU_NEWLY_IDLE) - if (env.src_grp_nr_running > 1) - sd->nr_balance_failed++; + sd->nr_balance_failed++; if (need_active_balance(&env)) { unsigned long flags;