sched: prevent race where update CPU cycles

Updating cycle counter should be serialized by holding rq lock.
Add missing rq lock hold when cycle counter is updated by irq entry
point.

Change-Id: I92cf75d047a45ebf15a6ddeeecf8fc3823f96e5d
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
This commit is contained in:
Joonwoo Park 2016-06-17 14:46:50 -07:00 committed by Kyle Yan
parent 14ac5ed8b8
commit 47c31979a1

View file

@ -3024,8 +3024,12 @@ void sched_account_irqstart(int cpu, struct task_struct *curr, u64 wallclock)
if (!rq->window_start || sched_disable_window_stats)
return;
if (is_idle_task(curr) && use_cycle_counter)
if (is_idle_task(curr)) {
/* We're here without rq->lock held, IRQ disabled */
raw_spin_lock(&rq->lock);
update_task_cpu_cycles(curr, cpu);
raw_spin_unlock(&rq->lock);
}
}
static void reset_task_stats(struct task_struct *p)