On 6/4/19 12:41 PM, Alexander Duyck wrote: > On Mon, Jun 3, 2019 at 10:04 AM Nitesh Narayan Lal <nitesh@xxxxxxxxxx> wrote: >> Enables QEMU to call madvise on the pages which are reported >> by the guest kernel. >> >> Signed-off-by: Nitesh Narayan Lal <nitesh@xxxxxxxxxx> >> --- >> hw/virtio/trace-events | 1 + >> hw/virtio/virtio-balloon.c | 85 +++++++++++++++++++ >> include/hw/virtio/virtio-balloon.h | 2 +- >> include/qemu/osdep.h | 7 ++ >> .../standard-headers/linux/virtio_balloon.h | 1 + >> 5 files changed, 95 insertions(+), 1 deletion(-) > <snip> > >> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h >> index 840af09cb0..4d632933a9 100644 >> --- a/include/qemu/osdep.h >> +++ b/include/qemu/osdep.h >> @@ -360,6 +360,11 @@ void qemu_anon_ram_free(void *ptr, size_t size); >> #else >> #define QEMU_MADV_REMOVE QEMU_MADV_INVALID >> #endif >> +#ifdef MADV_FREE >> +#define QEMU_MADV_FREE MADV_FREE >> +#else >> +#define QEMU_MADV_FREE QEMU_MADV_INVALID >> +#endif > Is there a specific reason for making this default to INVALID instead > of just using DONTNEED? No specific reason. > I ran into some issues as my host kernel > didn't have support for MADV_FREE in the exported kernel headers > apparently so I was getting no effect. It seems like it would be > better to fall back to doing DONTNEED instead of just disabling the > functionality all together. Possibly, I will further look into it. >> #elif defined(CONFIG_POSIX_MADVISE) >> >> @@ -373,6 +378,7 @@ void qemu_anon_ram_free(void *ptr, size_t size); >> #define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID >> #define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID >> #define QEMU_MADV_REMOVE QEMU_MADV_INVALID >> +#define QEMU_MADV_FREE QEMU_MADV_INVALID > Same here. If you already have MADV_DONTNEED you could just use that > instead of disabling the functionality. > >> #else /* no-op */ >> >> @@ -386,6 +392,7 @@ void qemu_anon_ram_free(void *ptr, size_t size); >> #define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID >> #define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID >> #define QEMU_MADV_REMOVE QEMU_MADV_INVALID >> +#define QEMU_MADV_FREE QEMU_MADV_INVALID >> >> #endif >> -- Regards Nitesh
Attachment:
signature.asc
Description: OpenPGP digital signature