Change mmap parameters to avoid much swap thrashing
This commit is contained in:
parent
53dbba7695
commit
2c9910cd99
1 changed files with 1 additions and 1 deletions
|
@ -331,7 +331,7 @@ static void *mmap_file(const char *fname, uint64_t *mm_length) {
|
|||
int fd = open(fname, O_RDONLY);
|
||||
if (fd == -1) return 0;
|
||||
int64_t length = lseek(fd, 0, SEEK_END);
|
||||
void *addr = mmap(NULL, length, PROT_READ, MAP_SHARED, fd, 0);
|
||||
void *addr = mmap(NULL, length, PROT_READ, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, fd, 0);
|
||||
close(fd);
|
||||
if (addr == MAP_FAILED) return 0;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue