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:
parent
14ac5ed8b8
commit
47c31979a1
1 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue