Skip to content

Commit

Permalink
On POSIX stop map_handle::commit() calling madvise() on non-file back…
Browse files Browse the repository at this point in the history
…ed allocations.
  • Loading branch information
ned14 committed Aug 19, 2021
1 parent 4186176 commit 044418d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion include/llfio/v2.0/detail/impl/posix/map_handle.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
1 change: 0 additions & 1 deletion include/llfio/v2.0/detail/impl/posix/utils.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 044418d

Please sign in to comment.