niyue commented on a change in pull request #11588:
URL: https://github.com/apache/arrow/pull/11588#discussion_r740771778
##########
File path: cpp/src/arrow/util/io_util.cc
##########
@@ -1090,19 +1106,15 @@ Status MemoryAdviseWillNeed(const
std::vector<MemoryRegion>& regions) {
}
return Status::OK();
#elif defined(POSIX_MADV_WILLNEED)
- for (const auto& region : regions) {
- if (region.size != 0) {
- const auto aligned = align_region(region);
- int err = posix_madvise(aligned.addr, aligned.size, POSIX_MADV_WILLNEED);
- // EBADF can be returned on Linux in the following cases:
- // - the kernel version is older than 3.9
- // - the kernel was compiled with CONFIG_SWAP disabled (ARROW-9577)
- if (err != 0 && err != EBADF) {
- return IOErrorFromErrno(err, "posix_madvise failed");
- }
- }
- }
Review comment:
I extract this piece of code from `MemoryAdviseWillNeed` API so that it
can be used to provide other advices to OS.
--
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]