From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> Add QEMU_MADV_NOHUGEPAGE as an OS-independent version of MADV_NOHUGEPAGE.
We include sys/mman.h before making the test to ensure that we pick up the system defines. Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com> Reviewed-by: Juan Quintela <quint...@redhat.com> Reviewed-by: Amit Shah <amit.s...@redhat.com> Signed-off-by: Juan Quintela <quint...@redhat.com> --- include/qemu/osdep.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index ab2d5d9..861d84b 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -139,6 +139,8 @@ void qemu_anon_ram_free(void *ptr, size_t size); #if defined(CONFIG_MADVISE) +#include <sys/mman.h> + #define QEMU_MADV_WILLNEED MADV_WILLNEED #define QEMU_MADV_DONTNEED MADV_DONTNEED #ifdef MADV_DONTFORK @@ -171,6 +173,11 @@ void qemu_anon_ram_free(void *ptr, size_t size); #else #define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID #endif +#ifdef MADV_NOHUGEPAGE +#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE +#else +#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID +#endif #elif defined(CONFIG_POSIX_MADVISE) @@ -182,6 +189,7 @@ void qemu_anon_ram_free(void *ptr, size_t size); #define QEMU_MADV_DODUMP QEMU_MADV_INVALID #define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID #define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID +#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID #else /* no-op */ @@ -193,6 +201,7 @@ void qemu_anon_ram_free(void *ptr, size_t size); #define QEMU_MADV_DODUMP QEMU_MADV_INVALID #define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID #define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID +#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID #endif -- 2.5.0