os::attempt_reserve_memory_at() is used to map memory at a specific address that we fancy. It is not used to replace an existing mapping (hence we omit MAP_FIXED).
But it may result in the kernel creating a mapping at a different address if our wish address is blocked; we then have to unmap again. That mmap-munmap cycle is unnecessary.
MAP_FIXED_NOREPLACE has existed since Linux 4.17 and prevents that unnecessary cycle . We should use that if available.
But it may result in the kernel creating a mapping at a different address if our wish address is blocked; we then have to unmap again. That mmap-munmap cycle is unnecessary.
MAP_FIXED_NOREPLACE has existed since Linux 4.17 and prevents that unnecessary cycle . We should use that if available.