From bbb602e183fbfad02bc1cbc7ab27b73cfe6744af Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Tue, 15 May 2018 19:04:20 +0200 Subject: [PATCH] Add systemd service unit to allow overcommitting memory on desktops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, a lot of users report that programs are crashing or hanging on their desktops. The reason is that newer Firefox and browsers in general need a lot of virtual memory for security reasons. Therefore, despite enough memory being available, it requests even more. Allowing to overcommit memory should fix this. After long discussion in the group, it was decided to allow to overcommit memory on desktop machines. Install it into the graphical target as it’s not needed beforehand. As overcommitting memory is enabled by default, maybe it should be reversed, but it currently doesn’t matter. --- install.sh | 1 + misc_systemd_units/enable_overcommit_memory.service | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 misc_systemd_units/enable_overcommit_memory.service diff --git a/install.sh b/install.sh index 392b952..58a73f9 100755 --- a/install.sh +++ b/install.sh @@ -80,6 +80,7 @@ mkdir -p "$DESTDIR$udev_helperdir" install_exec make-automaps/make-automaps "$DESTDIR$usr_sbindir/make-automaps" install_data misc_systemd_units/automount.service "$DESTDIR$systemdunitdir/automount.service" +install_data misc_systemd_units/enable_overcommit_memory.service "$DESTDIR$systemdunitdir/enable_overcommit_memory.service" install_data misc_systemd_units/gdm.service "$DESTDIR$systemdunitdir/gdm.service" install_data misc_systemd_units/lazy-umount-nfs.service "$DESTDIR$systemdunitdir/lazy-umount-nfs.service" install_exec mkmotd/mkmotd.pl "$DESTDIR$usr_sbindir/mkmotd.pl" diff --git a/misc_systemd_units/enable_overcommit_memory.service b/misc_systemd_units/enable_overcommit_memory.service new file mode 100644 index 0000000..4dcf8e7 --- /dev/null +++ b/misc_systemd_units/enable_overcommit_memory.service @@ -0,0 +1,13 @@ +[Unit] +Wants=startup-tags.service +After=startup-tags.service +ConditionPathExists=/node/tags/desktop + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/sbin/sysctl vm.overcommit_memory=0 +ExecStop=/usr/sbin/sysctl vm.overcommit_memory=2 + +[Install] +WantedBy=graphical.target