cgroup-util: Properly handle conditions where cgroup.threads is empty after SIGKILL...
authormsizanoen1 <msizanoen@qtmlabs.xyz>
Mon, 30 May 2022 15:08:07 +0000 (22:08 +0700)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 30 May 2022 20:03:31 +0000 (05:03 +0900)
commit37f0289bf5f2283c187032f83c33ea955b75f119
tree16c839db0a8d7444ea836369863534691b1fddc9
parent9a18321058f6be28cccb97fd8f1d70bcbc1e237d
cgroup-util: Properly handle conditions where cgroup.threads is empty after SIGKILL but processes still remain

After sending a SIGKILL to a process, the process might disappear from
`cgroup.threads` but still show up in `cgroup.procs` and still remains in the
cgroup and cause migrating new processes to `Delegate=yes` cgroups to fail with
`-EBUSY`. This is especially likely for heavyweight processes that consume more
kernel CPU time to clean up.

Fix this by only returning 0 when both `cgroup.threads` and
`cgroup.procs` are empty.
src/basic/cgroup-util.c