Reduce virtmgr threads
16 incoming threads is too many, especially since they are started immediately. Instead reduce it to 2 - chosen slightly arbitrarily. Remove the explicit configuration of outgoing threads/connections; the default (10) should be fine. See the comments on aosp/2461836. Bug: 245727626 Test: atest MicrodroidTests Change-Id: I7c7bef09411d649aed3b2914a88100dff22c0dbd
This commit is contained in:
parent
466d7580f2
commit
eab0cdf287
|
@ -29,7 +29,7 @@
|
|||
using namespace android::base;
|
||||
|
||||
static constexpr const char VIRTMGR_PATH[] = "/apex/com.android.virt/bin/virtmgr";
|
||||
static constexpr size_t VIRTMGR_THREADS = 16;
|
||||
static constexpr size_t VIRTMGR_THREADS = 2;
|
||||
|
||||
extern "C" JNIEXPORT jint JNICALL
|
||||
Java_android_system_virtualmachine_VirtualizationService_nativeSpawn(
|
||||
|
@ -83,7 +83,6 @@ Java_android_system_virtualmachine_VirtualizationService_nativeConnect(JNIEnv* e
|
|||
ARpcSession_setFileDescriptorTransportMode(session.get(),
|
||||
ARpcSession_FileDescriptorTransportMode::Unix);
|
||||
ARpcSession_setMaxIncomingThreads(session.get(), VIRTMGR_THREADS);
|
||||
ARpcSession_setMaxOutgoingConnections(session.get(), VIRTMGR_THREADS);
|
||||
// SAFETY - ARpcSession_setupUnixDomainBootstrapClient does not take ownership of clientFd.
|
||||
auto client = ARpcSession_setupUnixDomainBootstrapClient(session.get(), clientFd);
|
||||
return AIBinder_toJavaBinder(env, client);
|
||||
|
|
|
@ -57,7 +57,7 @@ const VIRTUALIZATION_SERVICE_BINDER_SERVICE_IDENTIFIER: &str =
|
|||
"android.system.virtualizationservice";
|
||||
|
||||
const VIRTMGR_PATH: &str = "/apex/com.android.virt/bin/virtmgr";
|
||||
const VIRTMGR_THREADS: usize = 16;
|
||||
const VIRTMGR_THREADS: usize = 2;
|
||||
|
||||
fn posix_pipe() -> Result<(OwnedFd, OwnedFd), io::Error> {
|
||||
use nix::fcntl::OFlag;
|
||||
|
@ -122,7 +122,6 @@ impl VirtualizationService {
|
|||
let session = RpcSession::new();
|
||||
session.set_file_descriptor_transport_mode(FileDescriptorTransportMode::Unix);
|
||||
session.set_max_incoming_threads(VIRTMGR_THREADS);
|
||||
session.set_max_outgoing_connections(VIRTMGR_THREADS);
|
||||
session
|
||||
.setup_unix_domain_bootstrap_client(self.client_fd.as_fd())
|
||||
.map_err(|_| io::Error::from(io::ErrorKind::ConnectionRefused))
|
||||
|
|
Loading…
Reference in New Issue