]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cgroup: rstat: use same convention to assign cgroup_base_stat
authorWei Yang <richard.weiyang@gmail.com>
Sat, 8 Jan 2022 00:38:16 +0000 (00:38 +0000)
committerTejun Heo <tj@kernel.org>
Wed, 12 Jan 2022 19:55:02 +0000 (09:55 -1000)
In function cgroup_base_stat_flush(), we update cgroup_base_stat by
getting rstatc->bstat and adjust delta to related fields.

There are two convention to assign cgroup_base_stat in this function:

  * rstat2 = rstat1
  * rstat2.cputime = rstat1.cputime

The second convention may make audience think just field "cputime" is
updated, while cputime is the only field in cgroup_base_stat.

Let's use the same convention to eliminate this confusion.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/rstat.c

index 9d331ba44870ab4715ec5444977a8441ec8af655..0b32fa62e93c1b1276c91d27a1df71021cd9cd25 100644 (file)
@@ -325,7 +325,7 @@ static void cgroup_base_stat_flush(struct cgroup *cgrp, int cpu)
        /* fetch the current per-cpu values */
        do {
                seq = __u64_stats_fetch_begin(&rstatc->bsync);
-               cur.cputime = rstatc->bstat.cputime;
+               cur = rstatc->bstat;
        } while (__u64_stats_fetch_retry(&rstatc->bsync, seq));
 
        /* propagate percpu delta to global */