From 24b3a66f36805c95f08c57cda775e28bb9b2fcdf Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Fri, 13 Oct 2023 19:44:10 +0200 Subject: [PATCH] feat: enable automounting of hugepages with 1GB pagesize if the karg hugepagesz=1G is present (#425) --- Containerfile | 1 + .../lib/systemd/system/dev-hugepages1G.mount | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 system_files/desktop/shared/usr/lib/systemd/system/dev-hugepages1G.mount diff --git a/Containerfile b/Containerfile index 40207e21..670234e6 100644 --- a/Containerfile +++ b/Containerfile @@ -283,6 +283,7 @@ RUN /tmp/image-info.sh && \ systemctl enable ublue-update.timer && \ systemctl enable bazzite-hardware-setup.service && \ systemctl enable tailscaled.service && \ + systemctl enable dev-hugepages1G.mount && \ systemctl --global enable bazzite-user-setup.service && \ if grep -q "kinoite" <<< "${BASE_IMAGE_NAME}"; then \ sed -i '/^PRETTY_NAME/s/Kinoite/Bazzite/' /usr/lib/os-release && \ diff --git a/system_files/desktop/shared/usr/lib/systemd/system/dev-hugepages1G.mount b/system_files/desktop/shared/usr/lib/systemd/system/dev-hugepages1G.mount new file mode 100644 index 00000000..5231ae10 --- /dev/null +++ b/system_files/desktop/shared/usr/lib/systemd/system/dev-hugepages1G.mount @@ -0,0 +1,31 @@ +# This file is a modified version of dev-hugepages.mount from systemd. +# +# With this unit file enabled you can set 1GB hugepages using kernel args +# and have them auto mounted, just as you would with 2MB hugepages. +# +# For normal systems use "hugepagesz=1G hugepages=16" +# to allocate 16 hugepages with a pagesize of 1GB +# +# For systems with numa nodes use "hugepagesz=1G hugepages=0:16" +# to allocate 16 hugepages on numa node 0 with a pagesize of 1GB +# +# For more info, consult the kernel.org documentation linked in this file + +[Unit] +Description=1GB Huge Pages File System +Documentation=https://docs.kernel.org/admin-guide/mm/hugetlbpage.html +Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems +ConditionPathExists=/sys/kernel/mm/hugepages +DefaultDependencies=no +ConditionCapability=CAP_SYS_ADMIN +ConditionVirtualization=!private-users +ConditionKernelCommandLine=hugepagesz=1G + +[Install] +WantedBy=multi-user.target + +[Mount] +What=hugetlbfs +Where=/dev/hugepages1G +Type=hugetlbfs +Options=pagesize=1G