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

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

sched/rt: Extend energy-aware task placement for SMP



For SMP, place the RT task on the least loaded CPU in the
first sched group/cluster. When placement boost is active
select the least loaded CPU across all CPU groups/clusters.

Change-Id: Ie193e8b6878c392fcc634b7efebfa73be5ab0562
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 7293b8b6
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -1757,7 +1757,7 @@ static int find_lowest_rq(struct task_struct *task)
	unsigned long tutil = task_util(task);
	int best_cpu_idle_idx = INT_MAX;
	int cpu_idle_idx = -1;
	bool placement_boost;
	enum sched_boost_policy placement_boost;
	bool do_rotate = false;
	bool avoid_prev_cpu = false;

@@ -1771,15 +1771,12 @@ static int find_lowest_rq(struct task_struct *task)
	if (!cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask))
		return -1; /* No targets found */

	if (energy_aware() && sysctl_sched_is_big_little) {
	if (energy_aware()) {
		sg_target = NULL;
		best_cpu = -1;

		/*
		 * Since this code is inside sched_is_big_little, we are going
		 * to assume that boost policy is SCHED_BOOST_ON_BIG
		 */
		placement_boost = sched_boost() == FULL_THROTTLE_BOOST;
		placement_boost = sched_boost() == FULL_THROTTLE_BOOST ?
				  sched_boost_policy() : SCHED_BOOST_NONE;
		best_capacity = placement_boost ? 0 : ULONG_MAX;

		rcu_read_lock();
@@ -1795,6 +1792,11 @@ static int find_lowest_rq(struct task_struct *task)
						sched_group_cpus(sg)))
				continue;

			if (!sysctl_sched_is_big_little) {
				sg_target = sg;
				break;
			}

			cpu = group_first_cpu(sg);
			cpu_capacity = capacity_orig_of(cpu);

@@ -1898,12 +1900,13 @@ static int find_lowest_rq(struct task_struct *task)
			goto retry;
		}

		if (best_cpu != -1) {
		if (best_cpu != -1 && placement_boost != SCHED_BOOST_ON_ALL) {
			return best_cpu;
		} else if (!cpumask_empty(&backup_search_cpu)) {
			cpumask_copy(&search_cpu, &backup_search_cpu);
			cpumask_clear(&backup_search_cpu);
			cpu = -1;
			placement_boost = SCHED_BOOST_NONE;
			goto retry;
		}
	}