experimental enable jemalloc API for FreeBSD too.#1294
Conversation
| #define MADV_HUGEPAGE 0 | ||
|
|
||
| #if !defined(JEMALLOC_VERSION_MAJOR) || (JEMALLOC_VERSION_MAJOR < 5) | ||
| #if (!defined(JEMALLOC_VERSION_MAJOR) || (JEMALLOC_VERSION_MAJOR < 5)) |
There was a problem hiding this comment.
This bit is not related.
| if (NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") | ||
| CHECK_INCLUDE_FILE_CXX(jemalloc/jemalloc.h FOLLY_USE_JEMALLOC) | ||
| else() | ||
| CHECK_INCLUDE_FILE_CXX(malloc_np.h FOLLY_USE_JEMALLOC) | ||
| endif() |
There was a problem hiding this comment.
Should switch the conditions around. That way, further conditions can easily be added as necessary.
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
...
else()
...
endif()
| #if !defined(__FreeBSD__) | ||
| #include <jemalloc/jemalloc.h> | ||
| #if (JEMALLOC_VERSION_MAJOR >= 5) | ||
| #else | ||
| #include <malloc_np.h> | ||
| #endif |
| #else | ||
| #include <malloc_np.h> | ||
| #endif | ||
| #if defined(__FreeBSD__) || (JEMALLOC_VERSION_MAJOR >= 5) |
There was a problem hiding this comment.
Why do we need the __FreeBSD__ check here? Does jemalloc on FreeBSD not define JEMALLOC_VERSION_MAJOR?
There was a problem hiding this comment.
Nope. they keep all "close to the vest". fair enough for the rest.
| #endif | ||
| // JEMalloc provides it's own implementation of | ||
| // malloc_usable_size, and that's what we should be using. | ||
| #ifndef __FreeBSD__ |
There was a problem hiding this comment.
I prefer #if !defined(...), since that way it is easier to add clauses to the condition as necessary.
b6c4424 to
ec75352
Compare
| #if defined(FOLLY_USE_JEMALLOC) && !FOLLY_SANITIZE | ||
|
|
||
| #include <folly/portability/SysMman.h> | ||
| #if !defined(__FreeBSD__) |
| */ | ||
| #if (defined(USE_JEMALLOC) || defined(FOLLY_USE_JEMALLOC)) && !FOLLY_SANITIZE | ||
| // We have JEMalloc, so use it. | ||
| #if !defined(__FreeBSD__) |
| #endif | ||
| // JEMalloc provides it's own implementation of | ||
| // malloc_usable_size, and that's what we should be using. | ||
| #if !defined(__FreeBSD__) |
ec75352 to
1d8bd97
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
@yfeldblum has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
There was some duplication here, the root cause of which I address in d054e34 (on master). Please rebase past that and resolve conflicts? |
Contrary to other systems, jemalloc is part of the FreeBSD's libc. As such APIs are directly exposed. Enabling super pages as well, supporting same page size.
1d8bd97 to
32a5e4e
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
@yfeldblum has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@yfeldblum merged this pull request in 647ad23. |
Contrary to other systems, jemalloc is part of the FreeBSD's libc.
As such APIs are directly exposed. Enabling super pages
as well, supporting same page size.