Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pcmoritz committed Aug 19, 2017
1 parent 225429b commit ffb9916
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
8 changes: 0 additions & 8 deletions cpp/src/plasma/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=20

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-conversion")

option(ARROW_PLASMA_HUGEPAGES
"Enable huge page tables support in plasma"
OFF)

if(ARROW_PLASMA_HUGEPAGES)
add_definitions(-DARROW_PLASMA_HUGEPAGES)
endif()

# Compile flatbuffers

set(PLASMA_FBS_SRC "${CMAKE_CURRENT_LIST_DIR}/format/plasma.fbs" "${CMAKE_CURRENT_LIST_DIR}/format/common.fbs")
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/plasma/malloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ int fake_munmap(void*, int64_t);
#define HAVE_MORECORE 0
#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T

#ifndef ARROW_PLASMA_HUGEPAGES
#define DEFAULT_GRANULARITY ((size_t)128U * 1024U) // 128KB
#else
#define DEFAULT_GRANULARITY ((size_t)1024U * 1024U * 1024U) // 1GB
#endif
#define DEFAULT_GRANULARITY ((size_t)128U * 1024U)

#include "thirdparty/dlmalloc.c" // NOLINT

Expand Down Expand Up @@ -199,3 +195,7 @@ void get_malloc_mapinfo(void* addr, int* fd, int64_t* map_size, ptrdiff_t* offse
*map_size = 0;
*offset = 0;
}

void set_malloc_granularity(int value) {
change_mparam(M_GRANULARITY, value);
}
2 changes: 2 additions & 0 deletions cpp/src/plasma/malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@

void get_malloc_mapinfo(void* addr, int* fd, int64_t* map_length, ptrdiff_t* offset);

void set_malloc_granularity(int value);

#endif // MALLOC_H
2 changes: 2 additions & 0 deletions cpp/src/plasma/store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ int main(int argc, char* argv[]) {
"/dev/shm. If you are inside a Docker container, you may need to "
"pass an argument with the flag '--shm-size' to 'docker run'.";
}
} else {
set_malloc_granularity(1024 * 1024 * 1024); // 1 GB
}
#endif
// Make it so dlmalloc fails if we try to request more memory than is
Expand Down

0 comments on commit ffb9916

Please sign in to comment.