Hi Escape. On Tue, Jun 28, 2022 at 09:09:48PM +0800, "taoyi.ty" <escape@xxxxxxxxxxxxxxxxx> wrote: > I found that rename(2) can be used in cgroup v1 but is disallowed in cgroup > v2, what's the reason for this design? There's some info in the commit 6db8e85c5c1f89cd0183b76dab027c81009f129f. > rename(2) is critical when managing a cgroup pool in userspace, which uses > rename to reuse cgroup rather than mkdir to create a new one, Strictly speaking, it's not critical if you decouple your job and cgroup naming scheme (i.e. use the cgroup with the old name). > this can improve the performance of container concurrent startup, > because renaming cgroup is much more lightweight compared with > creating cgroup. Do you have some numbers for this? You can save work with not rmdir/mkdir'ing but you mention concurrent startup specifically. And you still need to (re)setup the cgroups after reuse and that also isn't parallelizable (at least you need to (re)populate each reused cgroup, which is mostly under one lock). (Even cgroup1_rename() has an exclusive section under cgroup_mutex but it looks relatively simply.) Michal