diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index 63e43de2f310..49509dd5e5e2 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -196,7 +196,6 @@ static void walt_find_best_target(struct sched_domain *sd, cpumask_t visit_cpus; struct walt_task_struct *wts = (struct walt_task_struct *) p->android_vendor_data1; struct cfs_rq *cfs_rq; - bool active_task = task_on_rq_queued(p); /* Find start CPU based on boost value */ start_cpu = fbt_env->start_cpu; @@ -215,9 +214,6 @@ static void walt_find_best_target(struct sched_domain *sd, most_spare_wake_cap = LONG_MIN; } - if (active_task) - most_spare_wake_cap = ULONG_MAX; - /* fast path for prev_cpu */ if (((capacity_orig_of(prev_cpu) == capacity_orig_of(start_cpu)) || asym_cap_siblings(prev_cpu, start_cpu)) && @@ -338,12 +334,6 @@ static void walt_find_best_target(struct sched_domain *sd, continue; } - /* - * Consider only idle CPUs for active migration. - */ - if (active_task) - continue; - /* * Try to spread the rtg high prio tasks so that they * don't preempt each other. This is a optimisitc @@ -408,7 +398,7 @@ static void walt_find_best_target(struct sched_domain *sd, trace_sched_find_best_target(p, min_util, start_cpu, best_idle_cpu, most_spare_cap_cpu, target_cpu, order_index, end_index, - fbt_env->skip_cpu, active_task); + fbt_env->skip_cpu, task_on_rq_queued(p)); } static inline unsigned long diff --git a/kernel/sched/walt/walt_lb.c b/kernel/sched/walt/walt_lb.c index cff8b236c9a7..7caecafbd172 100644 --- a/kernel/sched/walt/walt_lb.c +++ b/kernel/sched/walt/walt_lb.c @@ -508,7 +508,9 @@ static void walt_lb_tick(void *unused, struct rq *rq) new_cpu = walt_find_energy_efficient_cpu(p, prev_cpu, 0, 1); rcu_read_unlock(); - if (new_cpu < 0 || same_cluster(new_cpu, prev_cpu)) + /* prevent active task migration to busy or same/lower capacity CPU */ + if (new_cpu < 0 || !available_idle_cpu(new_cpu) || + capacity_orig_of(new_cpu) <= capacity_orig_of(prev_cpu)) goto out_unlock; raw_spin_lock(&rq->lock);