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

Commit 0824857a authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

core_ctl: Update cluster->active_cpus in eval_need()



The cluster->active_cpus is not updated in eval_need(). The new need
for CPUs is compared against the previous cluster->active_cpus. If
another client isolates a CPU, cluster->active_cpus becomes stale and
we fail to detect the change in need for CPUs.

Change-Id: Ib58b8f0bd03dd2b4a174de2ac54eb0c60c59f9f7
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 046f2233
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -537,9 +537,8 @@ static bool eval_need(struct cluster_data *cluster)
	unsigned int need_cpus = 0, last_need, thres_idx;
	int ret = 0;
	bool need_flag = false;
	unsigned int active_cpus;
	unsigned int new_need;
	s64 now;
	s64 now, elapsed;

	if (unlikely(!cluster->inited))
		return 0;
@@ -549,8 +548,8 @@ static bool eval_need(struct cluster_data *cluster)
	if (cluster->boost) {
		need_cpus = cluster->max_cpus;
	} else {
		active_cpus = get_active_cpu_count(cluster);
		thres_idx = active_cpus ? active_cpus - 1 : 0;
		cluster->active_cpus = get_active_cpu_count(cluster);
		thres_idx = cluster->active_cpus ? cluster->active_cpus - 1 : 0;
		list_for_each_entry(c, &cluster->lru, sib) {
			if (c->busy >= cluster->busy_up_thres[thres_idx])
				c->is_busy = true;
@@ -566,17 +565,16 @@ static bool eval_need(struct cluster_data *cluster)
	last_need = cluster->need_cpus;
	now = ktime_to_ms(ktime_get());

	if (new_need > cluster->active_cpus) {
		ret = 1;
	} else {
		if (new_need == last_need) {
			cluster->need_ts = now;
			spin_unlock_irqrestore(&state_lock, flags);
			return 0;
		}

	if (need_cpus > cluster->active_cpus) {
		ret = 1;
	} else if (need_cpus < cluster->active_cpus) {
		s64 elapsed = now - cluster->need_ts;

		elapsed =  now - cluster->need_ts;
		ret = elapsed >= cluster->offline_delay_ms;
	}

@@ -584,7 +582,7 @@ static bool eval_need(struct cluster_data *cluster)
		cluster->need_ts = now;
		cluster->need_cpus = new_need;
	}
	trace_core_ctl_eval_need(cluster->first_cpu, last_need, need_cpus,
	trace_core_ctl_eval_need(cluster->first_cpu, last_need, new_need,
				 ret && need_flag);
	spin_unlock_irqrestore(&state_lock, flags);