Skip to content

cgroup2: Add Kill method to manager - #263

Merged
estesp merged 1 commit into
containerd:mainfrom
dcantah:cg2_kill
Jan 3, 2023
Merged

estesp merged 1 commit into
containerd:mainfrom
dcantah:cg2_kill

Conversation

@dcantah

@dcantah dcantah commented Dec 31, 2022 •

Copy link
Copy Markdown
Member

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>
Comment thread cgroup2/manager.go
if err == nil {
return nil
}
logrus.Warnf("falling back to slower kill implementation: %s", err)

Copy link
Copy Markdown
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

@estesp estesp left a comment

Copy link
Copy Markdown
Member

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