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

Skip to content
Commit 5c351b80 authored by Srivatsa Vaddagiri's avatar Srivatsa Vaddagiri Committed by Steve Muckle
Browse files

sched: window-stats: Fix potential wrong use of rq



'rq' reference to a cpu where a waking task last ran can be
potentially incorrect leading to incorrect accounting. This happens
when task_cpu() changes between points A & B in try_to_wake_up()
listed below:

try_to_wake_up()
{

cpu = src_cpu = task_cpu(p);
rq = cpu_rq(src_cpu);		-> Point A

..

while (p->on_cpu)
	cpu_relax();

smp_rmb();

raw_spin_lock(&rq->lock);	-> Point B

Fix this by initializing 'rq' variable after task has slept (its
on_cpu field becomes 0).

Also avoid adding task demand to its old cpu runqueue
(prev_runnable_sum) in case it's gone offline.

Change-Id: I9e5d3beeca01796d944137b5416805b983a6e06e
Signed-off-by: default avatarSrivatsa Vaddagiri <vatsa@codeaurora.org>
parent acdce027
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment