diff options
| author | Srivatsa Vaddagiri <vatsa@codeaurora.org> | 2014-05-28 17:53:37 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 19:59:37 -0700 |
| commit | 77952197a6f3836af929de42dd1659080a1b1d3a (patch) | |
| tree | 6e20b33614e3d91eb94adc7fbd0087ae4acaced4 /kernel/sched | |
| parent | 7f78facb9a3dea1bcad4b41a4d253fa698ed07e8 (diff) | |
sched: update task statistics when CPU frequency changes
A CPU may have its frequency changed by a different CPU. Because of
this, it is not guaranteed that we will update task statistics at
approximately the same time that the frequency change occurs. To
guard against accruing time to a task at the wrong frequency, update
the task's window-based statistics if the CPU it is running on
changes frequency.
Change-Id: I333c3f8aa82676bd2831797b55fd7af9c4225555
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
Diffstat (limited to 'kernel/sched')
| -rw-r--r-- | kernel/sched/core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 69f8aef5a849..a38cd7962fb3 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8149,12 +8149,18 @@ static int cpufreq_notifier_trans(struct notifier_block *nb, { struct cpufreq_freqs *freq = (struct cpufreq_freqs *)data; unsigned int cpu = freq->cpu, new_freq = freq->new; + struct rq *rq = cpu_rq(cpu); + unsigned long flags; if (val != CPUFREQ_POSTCHANGE) return 0; BUG_ON(!new_freq); + + raw_spin_lock_irqsave(&rq->lock, flags); + update_task_ravg(rq->curr, rq, TASK_UPDATE, sched_clock(), NULL); cpu_rq(cpu)->cur_freq = new_freq; + raw_spin_unlock_irqrestore(&rq->lock, flags); return 0; } |
