[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [qemu-xen master] qcow2: Make qcow2_cache_table_release() work only in Linux
commit 2f2c8d6b371cfc6689affb0b7e463fa2160c9e5b Author: Alberto Garcia <berto@xxxxxxxxxx> AuthorDate: Fri Nov 25 13:27:43 2016 +0200 Commit: Kevin Wolf <kwolf@xxxxxxxxxx> CommitDate: Fri Nov 25 13:51:30 2016 +0100 qcow2: Make qcow2_cache_table_release() work only in Linux We are using QEMU_MADV_DONTNEED to discard the memory of individual L2 cache tables. The problem with this is that those semantics are specific to the Linux madvise() system call. Other implementations of madvise() (including the very Linux implementation of posix_madvise()) don't do that, so we cannot use them for the same purpose. This patch makes the code Linux-specific and uses madvise() directly since there's no point in going through qemu_madvise() for this. Signed-off-by: Alberto Garcia <berto@xxxxxxxxxx> Signed-off-by: Kevin Wolf <kwolf@xxxxxxxxxx> --- block/qcow2-cache.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 6eaefed..ab8ee2d 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -66,7 +66,8 @@ static inline int qcow2_cache_get_table_idx(BlockDriverState *bs, static void qcow2_cache_table_release(BlockDriverState *bs, Qcow2Cache *c, int i, int num_tables) { -#if QEMU_MADV_DONTNEED != QEMU_MADV_INVALID +/* Using MADV_DONTNEED to discard memory is a Linux-specific feature */ +#ifdef CONFIG_LINUX BDRVQcow2State *s = bs->opaque; void *t = qcow2_cache_get_table_addr(bs, c, i); int align = getpagesize(); @@ -74,7 +75,7 @@ static void qcow2_cache_table_release(BlockDriverState *bs, Qcow2Cache *c, size_t offset = QEMU_ALIGN_UP((uintptr_t) t, align) - (uintptr_t) t; size_t length = QEMU_ALIGN_DOWN(mem_size - offset, align); if (length > 0) { - qemu_madvise((uint8_t *) t + offset, length, QEMU_MADV_DONTNEED); + madvise((uint8_t *) t + offset, length, MADV_DONTNEED); } #endif } -- generated by git-patchbot for /home/xen/git/qemu-xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |