summaryrefslogtreecommitdiffstats
path: root/core/modules/system-tweaks
diff options
context:
space:
mode:
authorSimon Rettberg2022-07-22 12:17:45 +0200
committerSimon Rettberg2022-07-22 12:17:45 +0200
commita8500a0ddc31232e6b21ce5370be0fa1b49c1954 (patch)
treec935a5a9a372a05ff8036b2c2e3f1c830007990a /core/modules/system-tweaks
parent[vmware-common] Be more conservative regarding GPU VRAM (diff)
downloadmltk-a8500a0ddc31232e6b21ce5370be0fa1b49c1954.tar.gz
mltk-a8500a0ddc31232e6b21ce5370be0fa1b49c1954.tar.xz
mltk-a8500a0ddc31232e6b21ce5370be0fa1b49c1954.zip
[system-tweaks] Disable automatic memory compaction, do at session start
Diffstat (limited to 'core/modules/system-tweaks')
-rw-r--r--core/modules/system-tweaks/data/etc/systemd/system/general-system-tweaks.service7
l---------core/modules/system-tweaks/data/etc/systemd/system/multi-user.target.wants/general-system-tweaks.service1
-rwxr-xr-xcore/modules/system-tweaks/data/opt/openslx/pam/hooks/auth-final-exec.d/99-compact-memory.sh9
-rwxr-xr-xcore/modules/system-tweaks/data/opt/openslx/scripts/systemd-general_system_tweaks19
4 files changed, 36 insertions, 0 deletions
diff --git a/core/modules/system-tweaks/data/etc/systemd/system/general-system-tweaks.service b/core/modules/system-tweaks/data/etc/systemd/system/general-system-tweaks.service
new file mode 100644
index 00000000..8bf67972
--- /dev/null
+++ b/core/modules/system-tweaks/data/etc/systemd/system/general-system-tweaks.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Apply general system tweaks
+
+[Service]
+ExecStart=/opt/openslx/scripts/systemd-general_system_tweaks
+Type=oneshot
+RemainAfterExit=true
diff --git a/core/modules/system-tweaks/data/etc/systemd/system/multi-user.target.wants/general-system-tweaks.service b/core/modules/system-tweaks/data/etc/systemd/system/multi-user.target.wants/general-system-tweaks.service
new file mode 120000
index 00000000..11e1b73f
--- /dev/null
+++ b/core/modules/system-tweaks/data/etc/systemd/system/multi-user.target.wants/general-system-tweaks.service
@@ -0,0 +1 @@
+../general-system-tweaks.service \ No newline at end of file
diff --git a/core/modules/system-tweaks/data/opt/openslx/pam/hooks/auth-final-exec.d/99-compact-memory.sh b/core/modules/system-tweaks/data/opt/openslx/pam/hooks/auth-final-exec.d/99-compact-memory.sh
new file mode 100755
index 00000000..6d35a3cc
--- /dev/null
+++ b/core/modules/system-tweaks/data/opt/openslx/pam/hooks/auth-final-exec.d/99-compact-memory.sh
@@ -0,0 +1,9 @@
+#!/bin/ash
+
+# Compact memory now once at start of graphical session,
+# So VM will have as much contiguous blocks available
+# as possible.
+if [ "$PAM_TTY" = ":0" ]; then
+ echo 1 > /proc/sys/vm/compact_memory
+fi
+exit 0
diff --git a/core/modules/system-tweaks/data/opt/openslx/scripts/systemd-general_system_tweaks b/core/modules/system-tweaks/data/opt/openslx/scripts/systemd-general_system_tweaks
new file mode 100755
index 00000000..389a3ca2
--- /dev/null
+++ b/core/modules/system-tweaks/data/opt/openslx/scripts/systemd-general_system_tweaks
@@ -0,0 +1,19 @@
+#!/bin/ash
+
+# General stuff
+
+# Breaks performance with certain workloads, so disable.
+# See https://unix.stackexchange.com/a/185172 for details and further references
+echo never > /sys/kernel/mm/transparent_hugepage/defrag
+echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
+# New player in town doing pretty much the same, tame it
+echo 1 > /proc/sys/vm/compaction_proactiveness # default 20
+
+# run-parts-like stuff
+DIR="$0.d"
+if [ -d "$DIR" ]; then
+ for file in "$DIR"/*; do
+ [ -x "$file" ] && "$file"
+ done
+fi
+exit 0