Reduce oom score adj of Dbus Broker
Dbus broker uses 1.2GB and dosent get earlyoom killed until every other process is killed
due to its oom_score_adj value of -900. Reducing it to -600 to allow other processes
to stay alive when dbus broker uses >90% of the system's memory.
I see a 60 oom score decrease for every 100 adjust. Currently using 95% of the system's
memory has a badness score of 662. Now it should have a score of 842, which should be killed
early on in the earlyoom kill streak.
I see around 670 as the average badness score of other processes on the system.
Tested:
Messed around w oom score adj on real machine.
fusion2:
938ee1f0-6bc1-3d59-906a-5b3fa3ebf1db
d3520ed4-34e5-3769-95fb-bc66888327ce
dbc9a17c-df97-3dbe-8c39-00d568e517df
0c2880d3-2bf5-3faa-a772-fbb371e105ad
0c2880d3-2bf5-3faa-a772-fbb371e105ad
Test failure on one of the platforms.
Google-Bug-Id: 438738723
Change-Id: I7d48e15a73993c6d0c33bc0a2fec69696c90baa0
Signed-off-by: Edward Lee <edwarddl@google.com>
diff --git a/recipes-core/dbus/dbus-broker/0001-Reduce-oom_score_adj-Value-of-Dbus-Broker.patch b/recipes-core/dbus/dbus-broker/0001-Reduce-oom_score_adj-Value-of-Dbus-Broker.patch
new file mode 100644
index 0000000..133d23d
--- /dev/null
+++ b/recipes-core/dbus/dbus-broker/0001-Reduce-oom_score_adj-Value-of-Dbus-Broker.patch
@@ -0,0 +1,39 @@
+From 704d7cf7c02ece48576b3c0046639df385d59f94 Mon Sep 17 00:00:00 2001
+From: Edward Lee <edwarddl@google.com>
+Date: Tue, 2 Sep 2025 23:37:08 +0000
+Subject: [PATCH] Reduce oom_score_adj Value of Dbus Broker
+
+Dbus broker uses 1.2GB and dosent get earlyoom killed until every other process is killed
+due to its oom_score_adj value of -900. Reducing it to -600 to allow other processes
+to stay alive when dbus broker uses >90% of the system's memory.
+
+I see a 60 oom score decrease for every 100 adjust. Currently using 95% of the system's
+memory has a badness score of 662. Now it should have a score of 842, which should be killed
+early on in the earlyoom kill streak.
+
+I see around 670 as the average badness score of other processes on the system.
+
+Upstream info / review: N/A
+Upstream-Status: Pending
+Justification: Temporary fix until we root cause the 1.2 GB usage of dbus-broker. b/438738723.
+Signed-off-by: Edward Lee <edwarddl@google.com>
+---
+ src/units/system/dbus-broker.service.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/units/system/dbus-broker.service.in b/src/units/system/dbus-broker.service.in
+index cc5ae36..2ca1921 100644
+--- a/src/units/system/dbus-broker.service.in
++++ b/src/units/system/dbus-broker.service.in
+@@ -10,7 +10,7 @@ Conflicts=shutdown.target
+ [Service]
+ Type=notify
+ Sockets=dbus.socket
+-OOMScoreAdjust=-900
++OOMScoreAdjust=-600
+ LimitNOFILE=16384
+ ProtectSystem=full
+ PrivateTmp=true
+--
+2.51.0.355.g5224444f11-goog
+
diff --git a/recipes-core/dbus/dbus-broker_%.bbappend b/recipes-core/dbus/dbus-broker_%.bbappend
new file mode 100644
index 0000000..be34d92
--- /dev/null
+++ b/recipes-core/dbus/dbus-broker_%.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS:prepend:gbmc := "${THISDIR}/${PN}:"
+
+SRC_URI:append:gbmc = " \
+ file://0001-Reduce-oom_score_adj-Value-of-Dbus-Broker.patch \
+"
\ No newline at end of file