Improve low-level mmap utilities (Linux/BSD)

Add madvise (MADV_WILLNEED) on utils::memory_commit
Add madvise (MADV_FREE or MADV_DONTNEED) on utils::memory_decommit
Improve shm_open pseudo-random name (not used on Linux)
This commit is contained in:
Nekotekina 2020-11-04 14:56:40 +03:00
parent ba5ed5f380
commit b66628baca
2 changed files with 19 additions and 5 deletions

View file

@ -88,9 +88,7 @@ static u8* add_jit_memory(std::size_t size, uint align)
if (olda != newa) [[unlikely]]
{
#ifdef CAN_OVERCOMMIT
madvise(pointer + olda, newa - olda, MADV_WILLNEED);
#else
#ifndef CAN_OVERCOMMIT
// Commit more memory
utils::memory_commit(pointer + olda, newa - olda, Prot);
#endif