Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pseudofs: cgroup: various improvements #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions core-services/00-pseudofs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ -z "$VIRTUALIZATION" ]; then
_cgroupv1=""
_cgroupv2=""

case "${CGROUP_MODE:-hybrid}" in
case "${CGROUP_MODE:-unified}" in
legacy)
_cgroupv1="/sys/fs/cgroup"
;;
Expand All @@ -40,11 +40,27 @@ if [ -z "$VIRTUALIZATION" ]; then
mkdir -p "$_controller"
mountpoint -q "$_controller" || mount -t cgroup -o "$_subsys_name" cgroup "$_controller"
done < /proc/cgroups
# always mount the systemd tracking cgroup,
# to support containerized systemd instances
mkdir -p /sys/fs/cgroup/systemd
mountpoint -q /sys/fs/cgroup/systemd || \
mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
CameronNemo marked this conversation as resolved.
Show resolved Hide resolved
fi

# cgroup v2
if [ -n "$_cgroupv2" ]; then
mkdir -p "$_cgroupv2"
mountpoint -q "$_cgroupv2" || mount -t cgroup2 -o nsdelegate cgroup2 "$_cgroupv2"
mountpoint -q "$_cgroupv2" || \
mount -t cgroup2 -o nsdelegate cgroup2 "$_cgroupv2"
fi
else
# in containers, unless otherwise configured,
# attempt to mount cgroup2 at the standard path,
# but never fail
if [ "${CGROUP_MODE:-unified}" = "unified" ]; then
_cgroup2="/sys/fs/cgroup"
mkdir -p "$_cgroup2"
mountpoint -q "$_cgroup2" || \
mount -t cgroup2 -o nsdelegate cgroup2 "$_cgroup2" || true
fi
fi
2 changes: 1 addition & 1 deletion rc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# cgroup v2 under /sys/fs/cgroup/unified
# legacy: mount cgroup v1 /sys/fs/cgroup
# unified: mount cgroup v2 under /sys/fs/cgroup
#CGROUP_MODE=hybrid
#CGROUP_MODE=unified

# Set this to true only if you do not want seed files to actually credit the
# RNG, for example if you plan to replicate this file system image and do not
Expand Down