uid_cputime: Avoids double accounting of process stime, utime and cpu…
authorRuchi Kandoi <kandoiruchi@google.com>
Fri, 27 Jan 2017 22:23:57 +0000 (22:23 +0000)
committerDanny Wood <danwood76@gmail.com>
Sun, 31 Mar 2019 08:48:08 +0000 (09:48 +0100)
commit1c1646e5d457f3a3fbcb383bfc03872b9fd905f1
tree52381087e8f8b29f25b45efb268d8631e56fd7e3
parenta8ef53f57b12ce5eef6840291f9480301fa8e490
uid_cputime: Avoids double accounting of process stime, utime and cpu…
…_power in task exit.

This avoids the race where a particular process is terminating and we
read the show_uid_stats. At this time since the task_struct still exists
and we will account for the terminating process as one of the active
task, where as the stats would have been added in the task exit
callback.

When the task is terminated, the cpu_power for that particular task is
added to the terminated tasks. 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 that race condition.

Bug: 22064385
Change-Id: Id2ae04b33fcd230eda9683a41b6019d4dd8f5d85
Signed-off-by: Jin Qian <jinqian@google.com>
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Git-commit: 344377047daa5832ef798af697adee388e367d57
Git-repo: https://android.googlesource.com/kernel/msm/
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
Change-Id: I405733725d535b0a864088516bf52fa3638ee6aa

Used commit: https://github.com/omnirom/android_kernel_lge_msm8992/commit/e36bbc4edde59683e980c816fb4a432fbbe594bb
drivers/cpufreq/cpufreq_stats.c