Re: [PATCH-cgroup v2] cgroup/rstat: Improve cgroup_rstat_push_children() documentation

From: Tejun Heo
Date: Fri Apr 25 2025 - 15:46:07 EST


On Thu, Apr 24, 2025 at 11:16:55PM -0400, Waiman Long wrote:
> The cgroup_rstat_push_children() function converts a set of
> updated_children lists from different cgroups into a single ordered
> list of cgroups to be flushed via the rstat_flush_next pointer.
> The algorithm used isn't that well illustrated and it takes time to
> grasp what it is doing. Improve the embedded documentation and variable
> names to better illustrate the transformation process and make the code
> easier to understand.
>
> Also cgroup_rstat_lock must be held for the whole duration
> from where the rstat_flush_next list is being constructed in
> cgroup_rstat_push_children() to when it is consumed later in
> css_rstat_flush(). Otherwise, list corruption can happen leading to
> system crash as reported in [1]. In this particular case, the branch
> being used has commit 093c8812de2d ("cgroup: rstat: Cleanup flushing
> functions and locking") which breaks this rule, but is missing the fix
> commit 7d6c63c31914 ("cgroup: rstat: call cgroup_rstat_updated_list
> with cgroup_rstat_lock") that fixes it.
>
> This patch has no functional change.
>
> [1] https://lore.kernel.org/lkml/BY5PR04MB68495E9E8A46CA9614D62669BCBB2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
>
> Signed-off-by: Waiman Long <longman@xxxxxxxxxx>

Applied to cgroup/for-6.16.

Thanks.

--
tejun