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

Commit 59dfcb4e authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched: Start using the primary cluster first on SMP



The primary cluster is the cluster for which energy is
lower compared to the other cluster. Containing the load
to this cluster before spilling to the other cluster
have power benefit.

Change-Id: I8bcde280d1ea29e5f3a5bb62eec803345073820e
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 35032850
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -6850,10 +6850,11 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync)
	struct related_thread_group *grp;
	cpumask_t search_cpus;
	int prev_cpu = task_cpu(p);
	int start_cpu = walt_start_cpu(prev_cpu);
	bool do_rotate = false;
	bool avoid_prev_cpu = false;

	sd = rcu_dereference(per_cpu(sd_ea, prev_cpu));
	sd = rcu_dereference(per_cpu(sd_ea, start_cpu));

	if (!sd)
		return target;
+4 −2
Original line number Diff line number Diff line
@@ -1758,6 +1758,8 @@ static int find_lowest_rq(struct task_struct *task)
	int best_cpu_idle_idx = INT_MAX;
	int cpu_idle_idx = -1;
	enum sched_boost_policy placement_boost;
	int prev_cpu = task_cpu(task);
	int start_cpu = walt_start_cpu(prev_cpu);
	bool do_rotate = false;
	bool avoid_prev_cpu = false;

@@ -1780,7 +1782,7 @@ static int find_lowest_rq(struct task_struct *task)
		best_capacity = placement_boost ? 0 : ULONG_MAX;

		rcu_read_lock();
		sd = rcu_dereference(per_cpu(sd_ea, task_cpu(task)));
		sd = rcu_dereference(per_cpu(sd_ea, start_cpu));
		if (!sd) {
			rcu_read_unlock();
			goto noea;
@@ -1840,7 +1842,7 @@ static int find_lowest_rq(struct task_struct *task)
			 */
			util = cpu_util(cpu);

			if (avoid_prev_cpu && cpu == task_cpu(task))
			if (avoid_prev_cpu && cpu == prev_cpu)
				continue;

			if (__cpu_overutilized(cpu, util + tutil))
+4 −0
Original line number Diff line number Diff line
@@ -2176,6 +2176,8 @@ static void sort_clusters(void)
	move_list(&cluster_head, &new_head, false);
}

int __read_mostly min_power_cpu;

void walt_sched_energy_populated_callback(void)
{
	struct sched_cluster *cluster;
@@ -2220,6 +2222,8 @@ void walt_sched_energy_populated_callback(void)
				break;
			}
		}

		min_power_cpu = cpu;
	}

	mutex_unlock(&cluster_lock);
+11 −0
Original line number Diff line number Diff line
@@ -285,6 +285,12 @@ void walt_irq_work(struct irq_work *irq_work);

void walt_sched_init(struct rq *rq);

extern int __read_mostly min_power_cpu;
static inline int walt_start_cpu(int prev_cpu)
{
	return sysctl_sched_is_big_little ? prev_cpu : min_power_cpu;
}

#else /* CONFIG_SCHED_WALT */

static inline void walt_sched_init(struct rq *rq) { }
@@ -356,6 +362,11 @@ fixup_walt_sched_stats_common(struct rq *rq, struct task_struct *p,
{
}

static inline int walt_start_cpu(int prev_cpu)
{
	return prev_cpu;
}

#endif /* CONFIG_SCHED_WALT */

#endif