From 7b75bd9619176405cba429f4483ca99db2391ce6 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Thu, 24 Aug 2017 22:50:56 -0700 Subject: [PATCH 1/2] Remove MAP_POPULATE flag when mmapping files in Plasma store. --- cpp/src/plasma/malloc.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/plasma/malloc.cc b/cpp/src/plasma/malloc.cc index 6b9bc62ab5a..9c3126b1747 100644 --- a/cpp/src/plasma/malloc.cc +++ b/cpp/src/plasma/malloc.cc @@ -135,10 +135,10 @@ void* fake_mmap(size_t size) { int fd = create_buffer(size); ARROW_CHECK(fd >= 0) << "Failed to create buffer during mmap"; #ifdef __linux__ - // MAP_POPULATE will pre-populate the page tables for this memory region - // which avoids work when accessing the pages later. Only supported on Linux. - void* pointer = - mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd, 0); + // MAP_POPULATE can be used to pre-populate the page tables for this memory region + // which avoids work when accessing the pages later. However it causes long pauses + // when mmapping the files. Only supported on Linux. + void* pointer = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); #else void* pointer = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); #endif From 8ed961280f54aaaae4fa669db82788264365ebdd Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Thu, 24 Aug 2017 23:24:39 -0700 Subject: [PATCH 2/2] Remove unnecessary ifdef. --- cpp/src/plasma/malloc.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cpp/src/plasma/malloc.cc b/cpp/src/plasma/malloc.cc index 9c3126b1747..52d362013f1 100644 --- a/cpp/src/plasma/malloc.cc +++ b/cpp/src/plasma/malloc.cc @@ -134,14 +134,10 @@ void* fake_mmap(size_t size) { int fd = create_buffer(size); ARROW_CHECK(fd >= 0) << "Failed to create buffer during mmap"; -#ifdef __linux__ // MAP_POPULATE can be used to pre-populate the page tables for this memory region // which avoids work when accessing the pages later. However it causes long pauses // when mmapping the files. Only supported on Linux. void* pointer = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); -#else - void* pointer = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); -#endif if (pointer == MAP_FAILED) { ARROW_LOG(ERROR) << "mmap failed with error: " << std::strerror(errno); if (errno == ENOMEM && plasma::plasma_config->hugepages_enabled) {