This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 841f4e01 Enable the jemalloc option --disable-cache-oblivious (#1575)
841f4e01 is described below

commit 841f4e01366a088645bf3d1f870032da731ca703
Author: Aleks Lozovyuk <[email protected]>
AuthorDate: Thu Jul 20 16:09:07 2023 +0300

    Enable the jemalloc option --disable-cache-oblivious (#1575)
    
    Inspired a Redis release notice, I add two options for optimizing jmalloc 
usages:
    
    - disable-cache - Disable thread-specific caches for small objects.  
Objects are cached and released in bulk, thus reducing the total number of 
mutex operations.
    - disable-cache-oblivious - Disable cache-oblivious significant allocation 
alignment for large allocation requests with no alignment constraints.  If this 
feature is disabled, all large allocations are page-aligned as an 
implementation artifact, which can severely harm CPU cache utilization. For 
more info, please take a look at the conversations in Redis - 
https://github.com/redis/redis/pull/12315 where these options are available 
starting at 7.3-rc2.
---
 cmake/jemalloc.cmake | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake
index 335d6b31..7ea6bc67 100644
--- a/cmake/jemalloc.cmake
+++ b/cmake/jemalloc.cmake
@@ -17,6 +17,12 @@
 
 include_guard()
 
+if (NOT DISABLE_CACHE_OBLIVIOUS)
+  set(DISABLE_CACHE_OBLIVIOUS "")
+else()
+  set(DISABLE_CACHE_OBLIVIOUS "--disable-cache-oblivious")
+endif()
+
 include(cmake/utils.cmake)
 
 FetchContent_DeclareGitHubWithMirror(jemalloc
@@ -31,7 +37,7 @@ if(NOT jemalloc_POPULATED)
   execute_process(COMMAND autoconf
     WORKING_DIRECTORY ${jemalloc_SOURCE_DIR}
   )
-  execute_process(COMMAND ${jemalloc_SOURCE_DIR}/configure 
CC=${CMAKE_C_COMPILER} -C --enable-autogen --disable-libdl 
--with-jemalloc-prefix=""
+  execute_process(COMMAND ${jemalloc_SOURCE_DIR}/configure 
CC=${CMAKE_C_COMPILER} -C --enable-autogen --disable-libdl 
${DISABLE_CACHE_OBLIVIOUS} --with-jemalloc-prefix=""
     WORKING_DIRECTORY ${jemalloc_BINARY_DIR}
   )
   add_custom_target(make_jemalloc 

Reply via email to