From 2dcb59d43fce8a881e168a7e33b01bf53d96679d Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 31 Mar 2023 23:28:43 +0200 Subject: [PATCH] Enable Multi-Gen LRU (#2392) * Enable Multi-Gen LRU Multi-Gen LRU should improve performance under memory pressure. This is especially useful for embedded platforms where memory is scarce. * Add service to configure Multi-Gen LRU Use min_ttl_ms of 1 which is the least aggressive in terms of lag. Since we are a server application, we can tune trashing prevention with a higher acceptable lag. --- buildroot-external/kernel/hassos.config | 2 +- .../usr/lib/systemd/system/haos-mglru.service | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 buildroot-external/rootfs-overlay/usr/lib/systemd/system/haos-mglru.service diff --git a/buildroot-external/kernel/hassos.config b/buildroot-external/kernel/hassos.config index 10847f220..6518f149e 100644 --- a/buildroot-external/kernel/hassos.config +++ b/buildroot-external/kernel/hassos.config @@ -15,7 +15,7 @@ CONFIG_ZSWAP_ZPOOL_DEFAULT_ZSMALLOC=y CONFIG_ZSMALLOC=y CONFIG_LRU_GEN=y -# CONFIG_LRU_GEN_ENABLED is not set +CONFIG_LRU_GEN_ENABLED=y CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/haos-mglru.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/haos-mglru.service new file mode 100644 index 000000000..2f3206977 --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/haos-mglru.service @@ -0,0 +1,11 @@ +[Unit] +Description=Configure multigenerational LRU +ConditionPathExists=/sys/kernel/mm/lru_gen/enabled + +[Service] +Type=oneshot + +ExecStart=/bin/sh -c "echo 1 > /sys/kernel/mm/lru_gen/min_ttl_ms" + +[Install] +WantedBy=basic.target