jacktengg commented on code in PR #9250: URL: https://github.com/apache/incubator-doris/pull/9250#discussion_r860402567
########## 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: memset explicitly here is for pre-pault the page, not for zero fill. As I tested, MAP_POPULATE seems have no effect for mremap as for 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org