Set memory of CompOS to 1 GB
CompOS previously requires more than 1 GB to succeed the compilation. We
simply set Microdroid's default memory to 2 GB at that time. But 1 GB
looks sufficient now.
Bug: 215768835
Test: ComposHostTestCases
Test: TH
Change-Id: Ic1cb56ab0d739b59783d5d083ada29a709e84b47
diff --git a/compos/common/compos_client.rs b/compos/common/compos_client.rs
index b54a921..f4b3440 100644
--- a/compos/common/compos_client.rs
+++ b/compos/common/compos_client.rs
@@ -46,6 +46,9 @@
use std::sync::{Arc, Condvar, Mutex};
use std::thread;
+// Enough memory to complete odrefresh in the VM.
+const VM_MEMORY_MIB: i32 = 1024;
+
/// This owns an instance of the CompOS VM.
pub struct VmInstance {
#[allow(dead_code)] // Keeps the VM alive even if we don`t touch it
@@ -119,9 +122,9 @@
configPath: config_path.to_owned(),
debugLevel: debug_level,
extraIdsigs: vec![idsig_manifest_apk_fd],
+ memoryMib: VM_MEMORY_MIB,
numCpus: parameters.cpus.map_or(1, NonZeroU32::get) as i32,
cpuAffinity: parameters.cpu_set.clone(),
- ..Default::default()
});
let vm = service
diff --git a/compos/compos_key_cmd/compos_key_cmd.cpp b/compos/compos_key_cmd/compos_key_cmd.cpp
index 8ed07e6..4312a5a 100644
--- a/compos/compos_key_cmd/compos_key_cmd.cpp
+++ b/compos/compos_key_cmd/compos_key_cmd.cpp
@@ -73,6 +73,8 @@
constexpr unsigned int kRpcPort = 6432;
+constexpr int kVmMemoryMib = 1024;
+
constexpr const char* kConfigApkPath =
"/apex/com.android.compos/app/CompOSPayloadApp/CompOSPayloadApp.apk";
@@ -279,7 +281,7 @@
appConfig.configPath = mPreferStaged ? kPreferStagedConfigFilePath : kDefaultConfigFilePath;
appConfig.debugLevel = mDebuggable ? VirtualMachineAppConfig::DebugLevel::FULL
: VirtualMachineAppConfig::DebugLevel::NONE;
- appConfig.memoryMib = 0; // Use default
+ appConfig.memoryMib = kVmMemoryMib;
LOG(INFO) << "Starting VM";
auto status = service->createVm(config, logFd, logFd, &mVm);