Skip to content

Commit 87a2255

Browse files
zulinx86Manciukic
authored andcommitted
docs(jailer): Clarify behavior of --parent-cgroup
Reorganized the description of --parent-cgroup into bullet points to make clear that its behavior depends on the combination of parameters. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent dbcad70 commit 87a2255

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

docs/jailer.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,28 @@ jailer --id <id> \
5252
create the entire cgroup hierarchy manually (which requires privileged
5353
permissions).
5454
- `--parent-cgroup` is used to allow the placement of microvm cgroups in custom
55-
nested hierarchies. By specifying this parameter, the jailer will create a new
56-
cgroup named `<id>` for the microvm in the `<cgroup_base>/<parent_cgroup>`
57-
subfolder. `<cgroup_base>` is the cgroup controller root for `cgroup v1` (e.g.
58-
`/sys/fs/cgroup/cpu`) or the unified controller hierarchy for `cgroup v2`
59-
(e.g. `/sys/fs/cgroup/unified`). `<parent_cgroup>` is a relative path within
60-
that hierarchy. For example, if `--parent-cgroup all_uvms/external_uvms` is
61-
specified, the jailer will write all cgroup parameters specified through
62-
`--cgroup` in `/sys/fs/cgroup/<controller_name>/all_uvms/external_uvms/<id>`.
63-
By default, the parent cgroup is the filename of `<exec_file>`, which will be
64-
henceforth referred to as `<exec_file_name>`. If there are no `--cgroup`
65-
parameters specified and `--group-version=2` was passed, then the jailer will
66-
move the process to the specified cgroup.
55+
nested hierarchies. The default value is the filename of `<exec_file>`, which
56+
will be henceforth referred to as `<exec_file_name>`. The behavior of this
57+
parameter depends on the following condition:
58+
- If either any `--cgroup` parameter is specifed or `--cgroup-version=1` is
59+
passed, the jailer will create a new cgroup named `<id>` for the microvm in
60+
the `<cgroup_base>/<parent_cgroup>` subfolder. `<cgroup_base>` is the cgroup
61+
controller root for cgroup v1 (e.g. `/sys/fs/cgroup/cpu`) or the unified
62+
controller hierarchy for cgroup v2 (e.g. `/sys/fs/cgroup/unified`).
63+
`<parent_cgroup>` is a relative path within that hierarchy. For example, if
64+
`--parent-cgroup all_uvms/external_uvms` is specified, the jailer will write
65+
all cgroup parameters specified through `--cgroup` in
66+
`/sys/fs/cgroup/<controller_name>/all_uvms/external_uvms/<id>`.
67+
- If no `--cgroup` parameters are specified and `--cgroup-version=2` is
68+
passed, the jailer will not create a new cgroup. If the cgroup specified
69+
with `--parent-cgroup` exists, the jailer will move the process to the
70+
specified cgroup, contrary to its name. This behavior can be used when users
71+
want to configure a cgroup beforehand by themselves and move the process to
72+
the configured cgroup. Note that, if the specified cgroup has domain
73+
controllers (e.g. memory) enabled in `cgroup.subtree_control`, the move
74+
fails due to ["no internal process constraint"][1] and jailer exits with an
75+
error. If the cgroup spcified with `--parent-cgroup` does not exist, the
76+
jailer does not move the process to any cgroup and proceeds without error.
6777
- `--chroot-base-dir` specifies the base folder where chroot jails are built.
6878
The default is `/srv/jailer`.
6979
- `--netns` specifies the path to a network namespace handle. If present, the
@@ -301,3 +311,5 @@ Note: default value for `<api-sock>` is `/run/firecracker.socket`.
301311
- If all the cgroup controllers are bunched up on a single mount point using the
302312
"all" option, our current program logic will complain it cannot detect
303313
individual controller mount points.
314+
315+
[1]: https://docs.kernel.org/admin-guide/cgroup-v2.html#no-internal-process-constraint

0 commit comments

Comments
 (0)