From 09c8fb541484f34a496809bc1c5708c90e9cb65c Mon Sep 17 00:00:00 2001 From: Jian-Hong Pan Date: Mon, 12 Dec 2022 15:21:23 +0800 Subject: [PATCH] data: Lower down gnome-shell process' OOM score When GNOME shell runs on a less memory system (for example 3 GB RAM), it is usually killed by the kernel OOM-killer easily. Because, it has a higher OOM score. However, GNOME desktop environment cannot do anything when the GNOME shell is killed. This commit adjusts and lowers down gnome-shell process' OOM score to avoid being killed by the kernel OOM-killer too early. In other words, sacrifices other processes first. Part-of: --- data/org.gnome.Shell@wayland.service.in | 3 +++ data/org.gnome.Shell@x11.service.in | 3 +++ 2 files changed, 6 insertions(+) diff --git a/data/org.gnome.Shell@wayland.service.in b/data/org.gnome.Shell@wayland.service.in index 38887eb19..76d5ccb1b 100644 --- a/data/org.gnome.Shell@wayland.service.in +++ b/data/org.gnome.Shell@wayland.service.in @@ -32,3 +32,6 @@ ExecStopPost=-/bin/sh -c 'test "$SERVICE_RESULT" != "exec-condition" && systemct Restart=no # Kill any stubborn child processes after this long TimeoutStopSec=5 + +# Lower down gnome-shell's OOM score to avoid being killed by OOM-killer too early +OOMScoreAdjust=-1000 diff --git a/data/org.gnome.Shell@x11.service.in b/data/org.gnome.Shell@x11.service.in index 7310f6608..078d87a3c 100644 --- a/data/org.gnome.Shell@x11.service.in +++ b/data/org.gnome.Shell@x11.service.in @@ -37,3 +37,6 @@ Restart=always RestartSec=0ms # Kill any stubborn child processes after this long TimeoutStopSec=5 + +# Lower down gnome-shell's OOM score to avoid being killed by OOM-killer too early +OOMScoreAdjust=-1000