Skip to content

Commit f9fd705

Browse files
authored
Merge pull request #1768 from giuseppe/drop-default-systemd-sub-cgroup
cgroup: do not create a sub-cgroup by default
2 parents 130c391 + 262d6ac commit f9fd705

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

crun.1

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -577,27 +577,29 @@ chown -R the_user.the_user /sys/fs/cgroup/systemd
577577
.EE
578578

579579
.SH \fBrun.oci.systemd.subgroup=SUBGROUP\fR
580-
Override the name for the systemd sub cgroup created under the systemd
581-
scope, so the final cgroup will be like:
580+
This configuration option allows you to define a sub-cgroup that will
581+
be created under a systemd-managed cgroup for your container.
582+
583+
.PP
584+
When SUBGROUP is specified, the complete cgroup path will follow this
585+
structure:
582586

583587
.EX
584588
/sys/fs/cgroup/$PATH/$SUBGROUP
585589
.EE
586590

587591
.PP
588-
When it is set to the empty string, a sub cgroup is not created.
589-
590-
.PP
591-
If not specified, it defaults to \fBcontainer\fR on cgroup v2, and to \fB""\fR
592-
on cgroup v1.
593-
594-
.PP
595-
e.g.
592+
If \fBSUBGROUP\fR is set to \fBcontainer\fR, a typical path could be:
596593

597594
.EX
598-
/sys/fs/cgroup//system.slice/foo-352700.scope/container
595+
/sys/fs/cgroup/system.slice/foo-352700.scope/container
599596
.EE
600597

598+
.PP
599+
If \fBSUBGROUP\fR is set to an empty string, no sub-cgroup will be
600+
created. By default, this option is not configured, meaning no
601+
sub-cgroup is created unless explicitly set.
602+
601603
.SH \fBrun.oci.delegate-cgroup=DELEGATED-CGROUP\fR
602604
If the \fBrun.oci.systemd.subgroup\fR annotation is specified, yet another
603605
sub-cgroup is created and the container process is moved here.

crun.1.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -489,24 +489,25 @@ chown -R the_user.the_user /sys/fs/cgroup/systemd
489489

490490
## `run.oci.systemd.subgroup=SUBGROUP`
491491

492-
Override the name for the systemd sub cgroup created under the systemd
493-
scope, so the final cgroup will be like:
492+
This configuration option allows you to define a sub-cgroup that will
493+
be created under a systemd-managed cgroup for your container.
494+
495+
When SUBGROUP is specified, the complete cgroup path will follow this
496+
structure:
494497

495498
```
496499
/sys/fs/cgroup/$PATH/$SUBGROUP
497500
```
498501

499-
When it is set to the empty string, a sub cgroup is not created.
500-
501-
If not specified, it defaults to `container` on cgroup v2, and to `""`
502-
on cgroup v1.
503-
504-
e.g.
505-
502+
If `SUBGROUP` is set to `container`, a typical path could be:
506503
```
507-
/sys/fs/cgroup//system.slice/foo-352700.scope/container
504+
/sys/fs/cgroup/system.slice/foo-352700.scope/container
508505
```
509506

507+
If `SUBGROUP` is set to an empty string, no sub-cgroup will be
508+
created. By default, this option is not configured, meaning no
509+
sub-cgroup is created unless explicitly set.
510+
510511
## `run.oci.delegate-cgroup=DELEGATED-CGROUP`
511512

512513
If the `run.oci.systemd.subgroup` annotation is specified, yet another

src/libcrun/cgroup-systemd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ find_systemd_subgroup (string_map *annotations)
19871987
return annotation;
19881988
}
19891989

1990-
return "container";
1990+
return NULL;
19911991
}
19921992

19931993
static int

0 commit comments

Comments
 (0)