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

Commit 1e393ec6 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Gerrit - the friendly Code Review server
Browse files

core_ctl: Fix current busy state value in core_ctl_set_busy trace point



core_ctl_set_busy() trace point is supposed to print the busy
state of a CPU in the past and current windows. But this trace
point is called before updating the busy state for the current
window. Fix this issue by moving trace point invocation to
eval_need().

Change-Id: I9acf783192122503dc6f2b599b3846effe8f9b26
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent fac669da
Loading
Loading
Loading
Loading
+6 −14
Original line number Diff line number Diff line
@@ -555,10 +555,15 @@ static bool eval_need(struct cluster_data *cluster)
		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) {
			bool old_is_busy = c->is_busy;

			if (c->busy >= cluster->busy_up_thres[thres_idx])
				c->is_busy = true;
			else if (c->busy < cluster->busy_down_thres[thres_idx])
				c->is_busy = false;

			trace_core_ctl_set_busy(c->cpu, c->busy, old_is_busy,
						c->is_busy);
			need_cpus += c->is_busy;
		}
		need_cpus = apply_task_need(cluster, need_cpus);
@@ -599,17 +604,6 @@ static void apply_need(struct cluster_data *cluster)
		wake_up_core_ctl_thread(cluster);
}

static void core_ctl_set_busy(struct cpu_data *c, unsigned int busy)
{
	unsigned int old_is_busy = c->is_busy;

	if (c->busy == busy)
		return;

	c->busy = busy;
	trace_core_ctl_set_busy(c->cpu, busy, old_is_busy, c->is_busy);
}

/* ========================= core count enforcement ==================== */

static void wake_up_core_ctl_thread(struct cluster_data *cluster)
@@ -669,7 +663,6 @@ EXPORT_SYMBOL(core_ctl_set_boost);
void core_ctl_check(u64 window_start)
{
	int cpu;
	unsigned int busy;
	struct cpu_data *c;
	struct cluster_data *cluster;
	unsigned int index = 0;
@@ -690,8 +683,7 @@ void core_ctl_check(u64 window_start)
		if (!cluster || !cluster->inited)
			continue;

		busy = sched_get_cpu_util(cpu);
		core_ctl_set_busy(c, busy);
		c->busy = sched_get_cpu_util(cpu);
	}

	update_running_avg();