niyue commented on pull request #11588:
URL: https://github.com/apache/arrow/pull/11588#issuecomment-961487813


   @westonpace 
   > in MemoryMappedFile::ReadAt we call 
::arrow::internal::MemoryAdviseWillNeed on the entire range accessed
   
   Thanks for the pointer, and I found this `MemoryAdviseWillNeed` is called 
inside `MemoryMappedFile::ReadAt` and is probably causing the problem I ran 
into.
   ```
    RETURN_NOT_OK(::arrow::internal::MemoryAdviseWillNeed(
         {{memory_map_->data() + position, static_cast<size_t>(nbytes)}}));
   ```
   
   I debugged the program previously and confirmed `MemoryMappedFile::ReadAt` 
didn't prefetch the array data after calling it, and the real IO only happens 
when the user program accesses the array value, so I thought mmap worked but OS 
didn't work as expected.  But I didn't think about that it advises OS to 
prefetch this range and made OS to behave differently. Let me do some more 
investigation to see how it works. Thanks so much.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to