You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/04/27 12:48:28 UTC

[GitHub] [incubator-doris] xinyiZzz commented on a diff in pull request #9250: [Enhancement][Vectorized] Improve hash table build efficiency

xinyiZzz commented on code in PR #9250:
URL: https://github.com/apache/incubator-doris/pull/9250#discussion_r859755912


##########
be/src/vec/common/allocator.h:
##########
@@ -146,8 +146,13 @@ class Allocator {
                                                           std::to_string(old_size) + " to " +
                                                           std::to_string(new_size) + ".",
                                                   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,
+                // Zero-fill 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);

Review Comment:
   Why manual zero-fill is needed here,
   
   CK's comment mentions that mmap is automatically zero-filled. The manual also seems to say so: https://linux.die.net/man/2/mmap



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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