-
Kirill Smelkov authored
I was going to use posix_madvise(POSIX_MADV_DONTNEED) in my tests to make sure a memory page should be evicted from kernel cache, but found out that this operation is hardcoded to be NOOP on Glibc/Linux systems: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/posix_madvise.c;h=c89fa64f0749;hb=HEAD#l25 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=8889e7aa461a On the other hand, as also verified by strace, `madvise(MADV_DONTNEED)` is not a NOOP as it actually goes to kernel by making syscall. Since it is not possible to use posix_madvise for what should be POSIX_MADV_DONTNEED behaviour, let's add all raw madvise behaviour flags as documented on http://man7.org/linux/man-pages/man2/madvise.2.html Presumably MADV_NORMAL and other behaviours that should translate 1-1 to POSIX ones were omitted in 59ac9991 (Add pxd for mmap & friends from "sys/mman.h" covering POSIX/Linux/BSD) to make people use the standardised POSIX interface. However given that it turned out to be not possible to use posix_madvise for all standard behaviours, system-specific madvise behaviours have to be used. (cherry picked from commit b394295b)
67653c5e