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

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

sched: EAS: fix idle_get_state_idx()



Consider a CPU is busy

- When a CPU has more than 1 runnable tasks but CPU is still
in idle state and about to exit or exiting idle state.

- When the CPU exits idle but idle_set_state_idx() is not
yet called.

Change-Id: I4830caf2828947be614a187c26e01e9b2950f1c1
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent eb486cc9
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -6905,8 +6905,7 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync)
			if (new_util > capacity_orig_of(i))
				continue;

			cpu_idle_idx = cpu_rq(i)->nr_running ? -1 :
				       idle_get_state_idx(cpu_rq(i));
			cpu_idle_idx = idle_get_state_idx(cpu_rq(i));

			if (!need_idle &&
			    (!wake_on_sibling ||
+0 −3
Original line number Diff line number Diff line
@@ -1970,9 +1970,6 @@ static int find_lowest_rq(struct task_struct *task)

				if (sysctl_sched_cstate_aware)
					cpu_idle_idx =
					    (cpu == smp_processor_id() ||
					     cpu_rq(cpu)->nr_running) ?
					     -1 :
					     idle_get_state_idx(cpu_rq(cpu));

				if (add_capacity_margin(new_util_cum) <
+4 −0
Original line number Diff line number Diff line
@@ -1491,6 +1491,10 @@ static inline void idle_set_state_idx(struct rq *rq, int idle_state_idx)
static inline int idle_get_state_idx(struct rq *rq)
{
	WARN_ON(!rcu_read_lock_held());

	if (rq->nr_running || cpu_of(rq) == raw_smp_processor_id())
		return -1;

	return rq->idle_state_idx;
}
#else