FelixYBW commented on issue #7860:
URL:
https://github.com/apache/incubator-gluten/issues/7860#issuecomment-2471595621
> > In io_util.cc, madvise(willneed) is called again. You may disable it.
>
> The new patch is here, but it's not working either. There might still be
some codes that haven't been found, I'll recheck it if required.
>
> ```diff
> diff -ru apache-arrow-15.0.0.orig/cpp/src/arrow/io/file.cc
apache-arrow-15.0.0/cpp/src/arrow/io/file.cc
> --- apache-arrow-15.0.0.orig/cpp/src/arrow/io/file.cc 2024-11-09
11:39:58.497266369 +0800
> +++ apache-arrow-15.0.0/cpp/src/arrow/io/file.cc 2024-11-09
18:09:06.540567675 +0800
> @@ -41,6 +41,7 @@
> #include <sstream>
> #include <string>
> #include <utility>
> +#include <iostream>
>
> // ----------------------------------------------------------------------
> // Other Arrow includes
> @@ -575,6 +576,12 @@
> return Status::IOError("Memory mapping file failed: ",
> ::arrow::internal::ErrnoMessage(errno));
> }
> + int madv_res = madvise(result, mmap_length, MADV_SEQUENTIAL);
> + if (madv_res != 0) {
> + return Status::IOError("madvise failed: ",
> + ::arrow::internal::ErrnoMessage(errno));
> + }
> + std::cerr << "madvise success: " << result << " " << mmap_length <<
std::endl;
> map_len_ = mmap_length;
> offset_ = offset;
> region_ = std::make_shared<Region>(shared_from_this(),
static_cast<uint8_t*>(result),
> @@ -660,8 +667,8 @@
> ARROW_ASSIGN_OR_RAISE(
> nbytes, internal::ValidateReadRange(position, nbytes,
memory_map_->size()));
> // Arrange to page data in
> - RETURN_NOT_OK(::arrow::internal::MemoryAdviseWillNeed(
> - {{memory_map_->data() + position, static_cast<size_t>(nbytes)}}));
> + // RETURN_NOT_OK(::arrow::internal::MemoryAdviseWillNeed(
> + // {{memory_map_->data() + position,
static_cast<size_t>(nbytes)}}));
> return memory_map_->Slice(position, nbytes);
> }
> ```
Thank you for your test. Can you try posix_fadvise? We have a case to show
madvise doesn't work on file mapping.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]