cpu_power: Avoids race condition when the task exits.
authorRuchi Kandoi <kandoiruchi@google.com>
Sat, 27 Jun 2015 02:02:08 +0000 (19:02 -0700)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 27 Oct 2015 08:28:04 +0000 (16:28 +0800)
commit4fd5475f2ee94d3766d7a227279add3f3038caa3
treef4b935da5dc85d908dcad8d50733dd1b2e4f3fb2
parent0512cdb54e2b0873c59a6b0f3dac3dff602616af
cpu_power: Avoids race condition when the task exits.

When the task is terminated, the cpu_power for that particular task is
added to the terminated tasks. cpu_power is set to ULLONG_MAX at this
point to avoid double accounting of the power. It is possible that before the
task releases all the resources, cpu reschedules the task or a timer
interrupt is fired. At this point we will try to add the additional time
to the process, which will cause the accounting to be skewed. This
avoids the case where we change the cpu_power when it is already set to
ULLONG_MAX.

Bug: 22064385
Change-Id: I405733725d535b0a864088516bf52fa3638ee6aa
Signed-off-by: Jin Qian <jinqian@google.com>
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
(cherry picked from commit fd72341df7e6e8b834f5d4ec86a30f248eb96385)
drivers/cpufreq/cpufreq_stats.c