summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Don <joshdon@google.com>2023-03-16 00:40:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-20 13:35:13 +0300
commit53244494bfcb9612b660f84c8c4f9b2282a766cd (patch)
tree766d8dbeee76214bea506c6346d7b3064249c287
parent226f6410fd43a2671c6d5d9272da484a3d13c168 (diff)
downloadlinux-53244494bfcb9612b660f84c8c4f9b2282a766cd.tar.xz
cgroup: fix display of forceidle time at root
commit fcdb1eda5302599045bb366e679cccb4216f3873 upstream. 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: Josh Don <joshdon@google.com> Fixes: 1fcf54deb767 ("sched/core: add forced idle accounting for cgroups") Cc: stable@vger.kernel.org # v6.0+ Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--kernel/cgroup/rstat.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
index 793ecff29038..7006fc8dd677 100644
--- a/kernel/cgroup/rstat.c
+++ b/kernel/cgroup/rstat.c
@@ -457,9 +457,7 @@ static void root_cgroup_cputime(struct cgroup_base_stat *bstat)
struct task_cputime *cputime = &bstat->cputime;
int i;
- cputime->stime = 0;
- cputime->utime = 0;
- cputime->sum_exec_runtime = 0;
+ memset(bstat, 0, sizeof(*bstat));
for_each_possible_cpu(i) {
struct kernel_cpustat kcpustat;
u64 *cpustat = kcpustat.cpustat;