From a9e351e6b9fb6406292094f84cb3a1c07124ccd4 Mon Sep 17 00:00:00 2001 From: Jacob Birkett Date: Sat, 19 Apr 2025 23:37:56 -0700 Subject: [PATCH] services: thinkfan: run with realtime priority --- nixos/modules/services/hardware/thinkfan.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/hardware/thinkfan.nix b/nixos/modules/services/hardware/thinkfan.nix index 33f1ae422b2dc..ca4d91ff56a1e 100644 --- a/nixos/modules/services/hardware/thinkfan.nix +++ b/nixos/modules/services/hardware/thinkfan.nix @@ -291,10 +291,17 @@ in ); thinkfan.serviceConfig = { Restart = "on-failure"; - RestartSec = "30s"; + RestartSec = "2s"; # slow restart is a problem if not exit cleanly # Hardening PrivateNetwork = true; + + # Run this process with near-realtime priority. + # + CPUSchedulingPolicy = "fifo"; + CPUSchedulingPriority = 20; # high, but not the highest + OOMScoreAdjust = -1000; # never kill this unit if out of memory + MemorySwapMax = 0; # never swap }; # must be added manually, see issue #81138