Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a8972ba authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "sched/fair: fix prefer_idle behaviour"

parents 35a4a2a8 70a86fb7
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -7135,6 +7135,7 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
	int most_spare_cap_cpu = -1;
	unsigned int active_cpus_count = 0;
	int prev_cpu = task_cpu(p);
	bool next_group_higher_cap = false;

	*backup_cpu = -1;

@@ -7444,18 +7445,36 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
			target_cpu = i;
		}

		next_group_higher_cap = (capacity_orig_of(group_first_cpu(sg)) <
			capacity_orig_of(group_first_cpu(sg->next)));

		/*
		 * If we've found a cpu, but the boost is ON_ALL we continue
		 * visiting other clusters. If the boost is ON_BIG we visit
		 * next cluster if they are higher in capacity. If we are
		 * not in any kind of boost, we break.
		 */
		if ((target_cpu != -1 || best_idle_cpu != -1) &&
		if (!prefer_idle &&
			(target_cpu != -1 || best_idle_cpu != -1) &&
			(fbt_env->placement_boost == SCHED_BOOST_NONE ||
			(fbt_env->placement_boost == SCHED_BOOST_ON_BIG &&
				(capacity_orig_of(group_first_cpu(sg)) >
				capacity_orig_of(group_first_cpu(sg->next))))))
				!next_group_higher_cap)))
			break;

		/*
		 * if we are in prefer_idle and have found an idle cpu,
		 * break from searching more groups based on the stune.boost and
		 * group cpu capacity.
		 */
		if (prefer_idle && best_idle_cpu != -1) {
			if (boosted) {
				if (!next_group_higher_cap)
					break;
			} else {
				if (next_group_higher_cap)
					break;
			}
		}

	} while (sg = sg->next, sg != sd->groups);