Skip to content

Commit

Permalink
vma_ops: Only use MADV_DONTNEED on Linux
Browse files Browse the repository at this point in the history
- MADV_DONTNEED semantics differ on non-Linux kernels, as in they don't free pages
  • Loading branch information
LekKit authored Feb 27, 2024
1 parent 12e3a23 commit c8d3a58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vma_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ bool vma_clean(void* addr, size_t size, bool lazy)
#ifdef MADV_FREE
if (lazy) return madvise(addr, size, MADV_FREE) == 0;
#endif
#ifdef MADV_DONTNEED
#if defined(__linux__) && defined(MADV_DONTNEED)
return madvise(addr, size, MADV_DONTNEED) == 0;
#endif
#endif
Expand Down

0 comments on commit c8d3a58

Please sign in to comment.