You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/04/29 17:12:43 UTC

[incubator-doris] 03/05: [Enhancement][Vectorized] Improve hash table build efficiency (#9250)

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

morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit a19a4822de66ff688f8e4aded0046eb61eab7c89
Author: jacktengg <18...@users.noreply.github.com>
AuthorDate: Fri Apr 29 14:26:33 2022 +0800

    [Enhancement][Vectorized] Improve hash table build efficiency (#9250)
    
    1. MAP_POPULATE is missing for mmap in Allocator, because macro OS_LINUX is not defined in allocator.h;
    2. MAP_POPULATE has no effect for mremap as for mmap, zero-fill enlarged memory range explicitly to pre-fault the pages
---
 be/CMakeLists.txt             | 8 ++++++++
 be/src/vec/common/allocator.h | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt
index 14183cf0d7..687a9629ca 100644
--- a/be/CMakeLists.txt
+++ b/be/CMakeLists.txt
@@ -43,6 +43,14 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(ppc64le.*|PPC64LE.*)")
     set (ARCH_PPC64LE 1)
 endif ()
 
+if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+    set (OS_LINUX 1)
+    add_definitions(-D OS_LINUX)
+elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+    set (OS_MACOSX 1)
+    add_definitions(-D OS_MACOSX)
+endif ()
+
 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     set (COMPILER_GCC 1)
 elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
diff --git a/be/src/vec/common/allocator.h b/be/src/vec/common/allocator.h
index 2a50dabf5c..d1f748d5b9 100644
--- a/be/src/vec/common/allocator.h
+++ b/be/src/vec/common/allocator.h
@@ -148,6 +148,13 @@ public:
                                                   doris::TStatusCode::VEC_CANNOT_MREMAP);
 
             /// No need for zero-fill, because mmap guarantees it.
+
+            if constexpr (mmap_populate) {
+                // MAP_POPULATE seems have no effect for mremap as for mmap,
+                // Clear enlarged memory range explicitly to pre-fault the pages
+                if (new_size > old_size)
+                    memset(reinterpret_cast<char*>(buf) + old_size, 0, new_size - old_size);
+            }
         } else if (new_size < MMAP_THRESHOLD) {
             /// Small allocs that requires a copy. Assume there's enough memory in system. Call CurrentMemoryTracker once.
             // CurrentMemoryTracker::realloc(old_size, new_size);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org