Skip to content

Conversation

@dcantah
Copy link
Member

@dcantah dcantah commented Dec 31, 2022

This adds in support for killing all of the processes in a cgroup. In 5.14+ this is very simple, a cgroup.kill file exists that all you need to do is write "1" to https://lwn.net/Articles/855924/. On kernels prior, or if the file doesn't exist to be more pedantic to account for potential backports, I've taken the approach runc currently uses which is a manual process of freezing the cgroup -> sending a signal to all of the processes -> thawing the cgroup.

This also adds in a simple test for this that should work on 5.14+ and prior kernels.

This adds in support for killing all of the processes in a cgroup. In
5.14+ this is very simple, a cgroup.kill file exists that all you need
to do is write "1" to https://lwn.net/Articles/855924/. On kernels prior,
or if the file doesn't exist to be more pedantic to account for potential
backports, I've taken the approach runc currently uses which is a manual
process of freezing the cgroup -> sending a signal to all of the processes
-> thawing the cgroup.

This also adds in a simple test for this that should work on 5.15+ and prior
kernels.

Signed-off-by: Danny Canter <danny@dcantah.dev>
if err == nil {
return nil
}
logrus.Warnf("falling back to slower kill implementation: %s", err)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is worth a Warn level

Copy link
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@estesp estesp merged commit fc3b020 into containerd:main Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants