Update MemoryMapping.cpp and signals.cpp

This commit is contained in:
Andrea Cavalli 2020-04-27 12:29:34 +02:00
parent 3bc0461de9
commit 4f8b29cfbd
2 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ Result<MemoryMapping> MemoryMapping::create_from_file(const FileFd &file_fd, con
auto data_offset = begin - fixed_begin;
auto data_size = narrow_cast<size_t>(end - fixed_begin);
void *data = mmap(nullptr, data_size, PROT_READ, MAP_PRIVATE, fd, narrow_cast<off_t>(fixed_begin));
void *data = mmap(nullptr, data_size, PROT_READ, MADV_MERGEABLE, fd, narrow_cast<off_t>(fixed_begin));
if (data == MAP_FAILED) {
return OS_ERROR("mmap call failed");
}

View File

@ -45,7 +45,7 @@ Status setup_signals_alt_stack() {
auto page_size = getpagesize();
auto stack_size = (MINSIGSTKSZ + 16 * page_size - 1) / page_size * page_size;
void *stack = mmap(nullptr, stack_size + 2 * page_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
void *stack = mmap(nullptr, stack_size + 2 * page_size, PROT_READ | PROT_WRITE, MAP_ANON | MADV_MERGEABLE, -1, 0);
if (stack == MAP_FAILED) {
return OS_ERROR("Mmap failed");
}