]> www.infradead.org Git - users/dwmw2/linux.git/commit
cgroup: rstat: Cleanup flushing functions and locking
authorYosry Ahmed <yosry.ahmed@linux.dev>
Wed, 19 Mar 2025 21:00:13 +0000 (21:00 +0000)
committerTejun Heo <tj@kernel.org>
Thu, 20 Mar 2025 16:53:02 +0000 (06:53 -1000)
commit093c8812de2d3436744fd10edab9bf816b94f833
tree9351971f502110e76032a7ee0693ef0bc95b5d41
parent0efc297a3c4974dbd609ee36fc6345720b6ca735
cgroup: rstat: Cleanup flushing functions and locking

Now that the rstat lock is being re-acquired on every CPU iteration in
cgroup_rstat_flush_locked(), having the initially acquire the lock is
unnecessary and unclear.

Inline cgroup_rstat_flush_locked() into cgroup_rstat_flush() and move
the lock/unlock calls to the beginning and ending of the loop body to
make the critical section obvious.

cgroup_rstat_flush_hold/release() do not make much sense with the lock
being dropped and reacquired internally. Since it has no external
callers, remove it and explicitly acquire the lock in
cgroup_base_stat_cputime_show() instead.

This leaves the code with a single flushing function,
cgroup_rstat_flush().

Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
Signed-off-by: Tejun Heo <tj@kernel.org>
include/linux/cgroup.h
kernel/cgroup/rstat.c