]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount-setup: Add memory_hugetlb_accounting to cgroupfs mount 39486/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 29 Oct 2025 15:30:07 +0000 (16:30 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 30 Oct 2025 21:28:41 +0000 (22:28 +0100)
This mount option will count HugeTLB memory usage towards the cgroup’s
overall memory usage for the memory controller.

See https://lore.kernel.org/all/20231006184629.155543-4-nphamcs@gmail.com/T/#u
for the patch introducing the new mount option.

NEWS
README
src/shared/mount-setup.c

diff --git a/NEWS b/NEWS
index b50a1e123e9bc1f78d3371328b72efd21d22a7bc..19894d6c1879c7fd7a9b5ada8d66cd125c56be53 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ systemd System and Service Manager
 
 CHANGES WITH 259 in spe:
 
+        * The cgroup2 file system is now mounted with the
+          "memory_hugetlb_accounting" mount option, supported since kernel 6.6.
+          This means that HugeTLB memory usage is now counted towards the
+          cgroup’s overall memory usage for the memory controller.
+
         * homectl's --recovery-key= option may now be used with the "update"
           command to add recovery keys to existing user accounts. Previously,
           recovery keys could only be configured during initial user creation.
diff --git a/README b/README
index 2e3acdd90703c0ba9c7b0d5afad37ddbc19fb2d5..89a9623cdc867d0f77fab9c57d7a23e6e867636a 100644 (file)
--- a/README
+++ b/README
@@ -68,7 +68,8 @@ REQUIREMENTS:
                      ≥ 6.3 for MFD_EXEC/MFD_NOEXEC_SEAL and tmpfs noswap option
                      ≥ 6.5 for name_to_handle_at() AT_HANDLE_FID, SO_PEERPIDFD/SO_PASSPIDFD,
                                and MOVE_MOUNT_BENEATH
-                     ≥ 6.6 for quota support on tmpfs
+                     ≥ 6.6 for quota support on tmpfs and cgroup2fs memory_hugetlb_accounting
+                           option
                      ≥ 6.9 for pidfs
                      ≥ 6.10 for fcntl(F_DUPFD_QUERY), unprivileged linkat(AT_EMPTY_PATH),
                             and block device 'partscan' sysfs attribute
index cd2b732b9bac4c62cc8bc1c2dbfd04699343d379..cbd3e1d10766f22db2c9b017997a90208ec3a78d 100644 (file)
@@ -50,7 +50,7 @@ static int cgroupfs_mount_options(int priority, const char *type, char **ret) {
         assert(ret);
 
         _cleanup_free_ char *opts = NULL;
-        FOREACH_STRING(o, "memory_recursiveprot") {
+        FOREACH_STRING(o, "memory_recursiveprot", "memory_hugetlb_accounting") {
                 r = mount_option_supported("cgroup2", o, /* value = */ NULL);
                 if (r < 0)
                         log_full_errno(priority, r, "Failed to determine whether cgroupfs supports '%s' mount option, assuming not: %m", o);