Skip to content

Commit fcdb1ed

Browse files
joshdonhtejun
authored andcommitted
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: Josh Don <joshdon@google.com> Fixes: 1fcf54d ("sched/core: add forced idle accounting for cgroups") Cc: stable@vger.kernel.org # v6.0+ Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 8d3c682 commit fcdb1ed

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

kernel/cgroup/rstat.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,7 @@ static void root_cgroup_cputime(struct cgroup_base_stat *bstat)
457457
struct task_cputime *cputime = &bstat->cputime;
458458
int i;
459459

460-
cputime->stime = 0;
461-
cputime->utime = 0;
462-
cputime->sum_exec_runtime = 0;
460+
memset(bstat, 0, sizeof(*bstat));
463461
for_each_possible_cpu(i) {
464462
struct kernel_cpustat kcpustat;
465463
u64 *cpustat = kcpustat.cpustat;

0 commit comments

Comments
 (0)