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

Commit aba51e0e authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar
Browse files

sched: remove skip_sg



This function was used to steer placements to allowed groups.
With earlier improvements on jumping to the correct start_cpu
this usefulness of this function is reduced.

Remove it and move the remaining useful functionality to
find_best_target().

In particular
* skip_sg would skip groups with all cores isolated. This
  would rarely be the situation in practice and moreover the
  loop that scans through cpus in the group would skip isolated
  cpus.
* skip_sg would skip groups once target is found. This can be
  easily moved in to the loop that traverses groups.
* skip_sg checks for situations where a task is confined to
  a cluster and forces us to visit that cluster. This is not
  required anymore as we traverse all the groups.

Change-Id: Ia85b18e44af72b90adacf4bb84b497147263c343
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent 54eebd20
Loading
Loading
Loading
Loading
+7 −28
Original line number Diff line number Diff line
@@ -7044,31 +7044,6 @@ static bool is_packing_eligible(struct task_struct *p, int target_cpu,
	return (estimated_capacity <= capacity_curr_of(target_cpu));
}

static inline bool skip_sg(struct task_struct *p, struct sched_group *sg,
			   struct cpumask *rtg_target,
			   unsigned long target_capacity)
{
	/* Are all CPUs isolated in this group? */
	if (!sg->group_weight)
		return true;

	/*
	 * Don't skip a group if a task affinity allows it
	 * to run only on that group.
	 */
	if (cpumask_subset(&p->cpus_allowed, sched_group_span(sg)))
		return false;

	/*
	 * if we have found a target cpu within a group, don't bother checking
	 * other groups
	 */
	if (target_capacity != ULONG_MAX)
		return true;

	return false;
}

static int start_cpu(struct task_struct *p, bool boosted,
		     struct cpumask *rtg_target)
{
@@ -7142,9 +7117,6 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
	/* Scan CPUs in all SDs */
	sg = sd->groups;
	do {
		if (skip_sg(p, sg, fbt_env->rtg_target, target_capacity))
			continue;

		for_each_cpu_and(i, &p->cpus_allowed, sched_group_span(sg)) {
			unsigned long capacity_curr = capacity_curr_of(i);
			unsigned long capacity_orig = capacity_orig_of(i);
@@ -7383,6 +7355,13 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
			!is_max_capacity_cpu(group_first_cpu(sg)))
			target_capacity = ULONG_MAX;

		/*
		 * if we have found a target cpu within a group, don't bother
		 * checking other groups
		 */
		if (target_capacity != ULONG_MAX)
			break;

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

	if (best_idle_cpu != -1 && !is_packing_eligible(p, target_cpu, fbt_env,