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

Commit 434dab22 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar
Browse files

sched/fair: do not reset target_capacity



Currently, we reset target_capacity to ULONG_MAX in placement boost.
This causes us to bypass that capacity check in the cpu loop thereby
allowing us to visit higher capacity cluster.

Instead choose to keep target_capacity intact and delete the capacity
check in cpu loop.

The capacity check was introduced by
commit cf9d0b63 ("sched/fair: fix
incorrect CPU selection for non latency sensitive tasks")
and it is safe to delete it because once we find a cpu in a group we
exit the group traversing loop. We will never have an situation
when we have found a cpu and are visiting higher capacity cluster,
except for placement boost when we intentionally want to visit higher
capacity cpus and were using the target_capacity = ULONG_MAX trick.

Change-Id: I73d25a1e7b30c0420e175371bd9f5911c71ddee0
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent 7b2a034c
Loading
Loading
Loading
Loading
+9 −29
Original line number Diff line number Diff line
@@ -7286,13 +7286,6 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
				continue;
			}

			/*
			 * Favor CPUs with smaller capacity for Non latency
			 * sensitive tasks.
			 */
			if (capacity_orig > target_capacity)
				continue;

			/*
			 * Case B) Non latency sensitive tasks on IDLE CPUs.
			 *
@@ -7383,29 +7376,16 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
		}

		/*
		 * For placement boost (or otherwise), we start with group
		 * where the task should be placed. When
		 * boost is active, and we are not at the highest
		 * capacity group reset the target_capacity to keep
		 * traversing to other higher clusters.
		 * If we already are at the highest capacity cluster we skip
		 * going around to the lower capacity cluster if we've found
		 * a cpu.
		 */
		if (fbt_env->placement_boost == SCHED_BOOST_ON_BIG) {
			if (capacity_orig_of(group_first_cpu(sg)) <
				capacity_orig_of(group_first_cpu(sg->next)))
				target_capacity = ULONG_MAX;
			else
				if (target_cpu != -1 || best_idle_cpu != -1)
					break;
		}

		/*
		 * if we have found a target cpu within a group, don't bother
		 * checking other groups, provided we are not in placement boost
		 * 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_capacity != ULONG_MAX)
		if ((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))))))
			break;

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