summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lee George Thomas <lgthomas@google.com> 2023-07-08 00:28:03 +0000
committer Lee George Thomas <lgthomas@google.com> 2023-07-17 13:56:19 -0700
commited6231e4ef5aa079ac85d974146339795eef4712 (patch)
tree7d5e82df7a6a2c3073dfae7680d0cf17f9162644
parentbc38028c8d2938d866fff1bba9d947e444f6106a (diff)
Signal lmkd to start psi monitoring after boot.
To save CPU cycles during boot for low resource device a new configuration is added to delay registration of psi monitoring until boot is complete. ActivityManagerService will send an lmkd message to start psi monitoring after boot. Bug: 288566858 Test: Build, boot and verified boot logs to confirm the behavior. (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9c63a06ddc00747d0f5901e4fb29025c9b1acdee) Merged-In: Iee5cecdae54304b092c6a1801f3814e13a919be2 Change-Id: Iee5cecdae54304b092c6a1801f3814e13a919be2
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java3
-rw-r--r--services/core/java/com/android/server/am/ProcessList.java10
2 files changed, 13 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index a5662ed6f7fa..b837688a29b2 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -5176,6 +5176,9 @@ public class ActivityManagerService extends IActivityManager.Stub
// Tell anyone interested that we are done booting!
SystemProperties.set("sys.boot_completed", "1");
+ // Start PSI monitoring in LMKD if it was skipped earlier.
+ ProcessList.startPsiMonitoringAfterBoot();
+
// And trigger dev.bootcomplete if we are not showing encryption progress
if (!"trigger_restart_min_framework".equals(VoldProperties.decrypt().orElse(""))
|| "".equals(VoldProperties.encrypt_progress().orElse(""))) {
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 2d6b875c1e3f..bce31734d064 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -350,6 +350,7 @@ public final class ProcessList {
static final byte LMK_UPDATE_PROPS = 7;
static final byte LMK_KILL_OCCURRED = 8; // Msg to subscribed clients on kill occurred event
static final byte LMK_STATE_CHANGED = 9; // Msg to subscribed clients on state changed
+ static final byte LMK_START_MONITORING = 9; // Start monitoring if delayed earlier
// Low Memory Killer Daemon command codes.
// These must be kept in sync with async_event_type definitions in lmkd.h
@@ -1483,6 +1484,15 @@ public final class ProcessList {
return true;
}
+ /**
+ * {@hide}
+ */
+ public static void startPsiMonitoringAfterBoot() {
+ ByteBuffer buf = ByteBuffer.allocate(4);
+ buf.putInt(LMK_START_MONITORING);
+ writeLmkd(buf, null);
+ }
+
private static boolean writeLmkd(ByteBuffer buf, ByteBuffer repl) {
if (!sLmkdConnection.isConnected()) {
// try to connect immediately and then keep retrying