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

Commit ffab6924 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched: Make energy_aware_wake_cpu() work for both SMP and big.LITTLE



In energy_aware_wake_cpu(), the CPU search is limited to the lowest
capacity CPU group/cluster which can fit the task. This does not
work well on a SMP system, since all CPUs have the same capacity.
Hence expand the search to all CPU groups/clusters for SMP.

Change-Id: Iaea5b907d584442c901f35980f0bbb3d8e70c630
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 50f30d5a
Loading
Loading
Loading
Loading
+155 −142
Original line number Diff line number Diff line
@@ -6822,7 +6822,7 @@ is_packing_eligible(struct task_struct *p, unsigned long task_util,
static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync)
{
	struct sched_domain *sd;
	struct sched_group *sg, *sg_target;
	struct sched_group *sg, *sg_target, *start_sg;
	int target_max_cap = INT_MAX;
	int target_cpu = -1, targeted_cpus = 0;
	unsigned long task_util_boosted = 0, curr_util = 0;
@@ -6876,9 +6876,8 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync)
		return cpu;
	}

	if (sysctl_sched_is_big_little) {
	task_util_boosted = boosted_task_util(p);

	if (sysctl_sched_is_big_little) {
		/*
		 * Find group with sufficient capacity. We only get here if no cpu is
		 * overutilized. We may end up overutilizing a cpu by adding the task,
@@ -6931,7 +6930,10 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync)
				target_max_cap = capacity_of(max_cap_cpu);
			}
		} while (sg = sg->next, sg != sd->groups);
	}

	start_sg = sg_target;
next_sg:
	cpumask_copy(&search_cpus, tsk_cpus_allowed(p));
	cpumask_and(&search_cpus, &search_cpus,
		    sched_group_cpus(sg_target));
@@ -7087,6 +7089,18 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync)
		goto retry;
	}

	/*
	 * If we don't find a CPU that fits this task without
	 * increasing OPP, expand the search to the other
	 * groups on a SMP system.
	 */
	if (!sysctl_sched_is_big_little && target_cpu == -1) {
		if (sg_target->next != start_sg) {
			sg_target = sg_target->next;
			goto next_sg;
		}
	}

	if (target_cpu == -1 ||
	    (target_cpu != min_util_cpu && !safe_to_pack &&
	     !is_packing_eligible(p, task_util_boosted, sg_target,
@@ -7100,7 +7114,6 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync)
		else
			target_cpu = task_cpu(p);
	}
	}

	if (target_cpu != task_cpu(p) && !avoid_prev_cpu &&
	    !cpu_isolated(task_cpu(p))) {