Skip to content

Commit 1adb5c6

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master'
2 parents 69753b2 + 1a331d7 commit 1adb5c6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/pageindex.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <wchar.h>
99
#include <unistd.h>
1010
#include <errno.h>
11+
#include <sys/mman.h>
1112
#include "raw-syscalls-defs.h"
1213
#include "librunt.h"
1314
#include "relf.h"
@@ -429,12 +430,15 @@ void __pageindex_init(void)
429430
{
430431
int fd = memfd_create("pageindex-lazy-region", 0);
431432
if (fd == -1) abort();
433+
size_t map_size = sizeof (bigalloc_num_t) * ((uintptr_t)(MAXIMUM_USER_ADDRESS + 1) >> LOG_PAGE_SIZE);
432434
pageindex = (bigalloc_num_t *) raw_mmap((void*) PAGEINDEX_ADDRESS,
433-
sizeof (bigalloc_num_t) * ((uintptr_t)(MAXIMUM_USER_ADDRESS + 1) >> LOG_PAGE_SIZE),
435+
map_size,
434436
PROT_READ|PROT_WRITE,
435437
MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE,
436438
fd, 0);
437439
if (pageindex == MAP_FAILED) { debug_printf(0, "Failed to map memfd fd %d (%s)\n", fd, strerror(errno)); abort(); }
440+
if (madvise(pageindex, map_size, MADV_DONTDUMP) < 0) { debug_printf(0, "Failed to madvise MADV_DONTDUMP (%s)\n", strerror(errno)); }
441+
438442
close(fd);
439443
install_lazy_pageindex_handler();
440444
debug_printf(3, "pageindex at %p (to be mapped lazily)\n", pageindex);

0 commit comments

Comments
 (0)