]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cgroup: rstat: explicitly put loop variant in while
authorWei Yang <richard.weiyang@gmail.com>
Sat, 25 Dec 2021 00:09:31 +0000 (00:09 +0000)
committerTejun Heo <tj@kernel.org>
Thu, 6 Jan 2022 21:10:06 +0000 (11:10 -1000)
Instead of do while unconditionally, let's put the loop variant in
while.

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

index 1abe7411452718a4a1b7b03a6daae31cf41e1410..bc699325827104dcb143cab6d2999c0b8e181672 100644 (file)
@@ -124,12 +124,10 @@ static struct cgroup *cgroup_rstat_cpu_pop_updated(struct cgroup *pos,
 
                        prstatc = cgroup_rstat_cpu(parent, cpu);
                        nextp = &prstatc->updated_children;
-                       while (true) {
+                       while (*nextp != pos) {
                                struct cgroup_rstat_cpu *nrstatc;
 
                                nrstatc = cgroup_rstat_cpu(*nextp, cpu);
-                               if (*nextp == pos)
-                                       break;
                                WARN_ON_ONCE(*nextp == parent);
                                nextp = &nrstatc->updated_next;
                        }