Skip to content

Commit

Permalink
systemd: add patch to increase mount rate limit
Browse files Browse the repository at this point in the history
Bottlerocket includes a lot of mount units, and the 5 mounts/s rate
limit leads to several throttles during the boot process. The higher
rate limit eliminates this, speeding up the boot by up to one second.

Setting `SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST` in the environment
can also change the rate limit, but this must be done on the kernel
command line. If we set it there by default, then it can't be tuned
by system administrators using `settings.boot.kernel-parameters`.

Signed-off-by: Ben Cressey <[email protected]>
  • Loading branch information
bcressey committed Aug 31, 2023
1 parent 006afce commit 6f17ad7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 1f8d86a74c09738eb000aacec6bbd74360177796 Mon Sep 17 00:00:00 2001
From: Ben Cressey <[email protected]>
Date: Thu, 31 Aug 2023 19:14:13 +0000
Subject: [PATCH] core/mount: increase mount rate limit burst to 25

On systems where many mounts are set up on boot, the default rate
limit is too low and leads to several stalls.

Signed-off-by: Ben Cressey <[email protected]>
---
src/core/mount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/mount.c b/src/core/mount.c
index d82092a..7ba009b 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1928,7 +1928,7 @@ static void mount_enumerate(Manager *m) {
mnt_init_debug(0);

if (!m->mount_monitor) {
- unsigned mount_rate_limit_burst = 5;
+ unsigned mount_rate_limit_burst = 25;
int fd;

m->mount_monitor = mnt_new_monitor();
--
2.40.1

5 changes: 5 additions & 0 deletions packages/systemd/systemd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ Patch9010: 9010-units-keep-modprobe-service-units-running.patch
# DBUS services not used in Bottlerocket
Patch9011: 9011-systemd-networkd-Conditionalize-hostnamed-timezoned-.patch

# Local patch to adjust the default mount rate limit to 25 per second.
# Carried as a patch so that SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST can be used
# as a kernel command line parameter to override.
Patch9012: 9012-core-mount-increase-mount-rate-limit-burst-to-25.patch

BuildRequires: gperf
BuildRequires: intltool
BuildRequires: meson
Expand Down

0 comments on commit 6f17ad7

Please sign in to comment.