Don't MAP_POPULATE native ZygoteCommandBuffer

Since we made it significantly larger, populating it will often waste
a bit of space.

Belated follow-up to aosp/2009575 .

Test: Build and boot AOSP.
Bug: 219763513
Change-Id: I5fdbd379942e92df52c079e52e35ebbee0429577
This commit is contained in:
Hans Boehm
2022-04-19 14:55:30 -07:00
parent 70c3d35319
commit 7f3e096b70

View File

@@ -296,7 +296,7 @@ jlong com_android_internal_os_ZygoteCommandBuffer_getNativeBuffer(JNIEnv* env, j
++buffersAllocd;
// MMap explicitly to get it page aligned.
void *bufferMem = mmap(NULL, sizeof(NativeCommandBuffer), PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_POPULATE, -1, 0);
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
// Currently we mmap and unmap one for every request handled by the Java code.
// That could be improved, but unclear it matters.
if (bufferMem == MAP_FAILED) {