0
Files
src/ipc
Ali Juma dff201a0ce Make macOS shared memory implementation work on iOS as well
iOS currently uses a file-based implementation of shared memory
(platform_shared_memory_region_posix.cc), that is responsible for a
significant fraction of Chrome's disk writes overall. While Chrome
on iOS never needs to share memory between processes, cross-platform
primitives like mojo pipes use PlatformSharedMemoryRegion on iOS too.

macOS currently uses an implementation of shared memory using
mach_make_memory_entry_64. This implementation nearly works on iOS
as-is, except that mach_vm_map is not available on iOS, which instead
supports vm_map (and similarly doesn't support other mach_vm_*
functions but supports their vm_* equivalents). macOS also supports
vm_map. The main advantage of mach_vm_map and the other mach_vm_*
functions is interoperability between 32-bit and 64-bit processes
(e.g., sharing memory between such processes), which is not an issue
for Chrome on macOS, since it is 64-bit only.

This CL modifies the macOS implementation of PlatformSharedMemoryRegion
to use vm_map instead of mach_vm_map, and uses this implementation on
iOS as well. This fixes the excessive disk write issue on iOS, and also
leaves iOS in a better state for a potential future where Chrome needs
to share memory between processes.

Change-Id: I9560cba636a371e684665d59869038e4f29b957e
Bug: 1327411
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3673160
Commit-Queue: Ali Juma <ajuma@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1009355}
2022-05-31 23:51:41 +00:00
..
2021-12-09 02:13:50 +00:00
2022-05-06 21:09:55 +00:00