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:
Srivatsa Vaddagiri <vatsa@codeaurora.org>
Loading
Please register or sign in to comment