diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-08-19 15:57:46 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-08-19 15:57:46 +0300 |
commit | 044418de759c225ec72e43e6fe74ce2a5ab0fdaf (patch) | |
tree | 33cb2e7bfc3e86cc6b115399cc8721d2f51cc007 | |
parent | 41861766afcbfb412fc6b01a3ac794878dfcb7c5 (diff) |
On POSIX stop map_handle::commit() calling madvise() on non-file backed allocations.
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/map_handle.ipp | 2 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/utils.ipp | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/include/llfio/v2.0/detail/impl/posix/map_handle.ipp b/include/llfio/v2.0/detail/impl/posix/map_handle.ipp index bf676d4a..397576a8 100644 --- a/include/llfio/v2.0/detail/impl/posix/map_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/map_handle.ipp @@ -534,7 +534,7 @@ result<map_handle::buffer_type> map_handle::commit(buffer_type region, section_h size_type bytes = region.size(); OUTCOME_TRYV(do_mmap(_v, region.data(), MAP_FIXED, _section, _pagesize, bytes, offset, flag)); // Tell the kernel we will be using these pages soon - if(-1 == ::madvise(region.data(), region.size(), MADV_WILLNEED)) + if(_section != nullptr && -1 == ::madvise(region.data(), region.size(), MADV_WILLNEED)) { return posix_error(); } diff --git a/include/llfio/v2.0/detail/impl/posix/utils.ipp b/include/llfio/v2.0/detail/impl/posix/utils.ipp index df6440a1..d0b21ba2 100644 --- a/include/llfio/v2.0/detail/impl/posix/utils.ipp +++ b/include/llfio/v2.0/detail/impl/posix/utils.ipp @@ -443,7 +443,6 @@ namespace utils result<process_cpu_usage> current_process_cpu_usage() noexcept { process_cpu_usage ret; - memset(&ret, 0, sizeof(ret)); #ifdef __linux__ try { |