Commit fcdb1eda authored by Josh Don's avatar Josh Don Committed by Tejun Heo

cgroup: fix display of forceidle time at root

We need to reset forceidle_sum to 0 when reading from root, since the
bstat we accumulate into is stack allocated.

To make this more robust, just replace the existing cputime reset with a
memset of the overall bstat.
Signed-off-by: default avatarJosh Don <joshdon@google.com>
Fixes: 1fcf54de ("sched/core: add forced idle accounting for cgroups")
Cc: stable@vger.kernel.org # v6.0+
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 8d3c682a
...@@ -457,9 +457,7 @@ static void root_cgroup_cputime(struct cgroup_base_stat *bstat) ...@@ -457,9 +457,7 @@ static void root_cgroup_cputime(struct cgroup_base_stat *bstat)
struct task_cputime *cputime = &bstat->cputime; struct task_cputime *cputime = &bstat->cputime;
int i; int i;
cputime->stime = 0; memset(bstat, 0, sizeof(*bstat));
cputime->utime = 0;
cputime->sum_exec_runtime = 0;
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
struct kernel_cpustat kcpustat; struct kernel_cpustat kcpustat;
u64 *cpustat = kcpustat.cpustat; u64 *cpustat = kcpustat.cpustat;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment