summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLiang Li <liang.z.li@intel.com>2016-03-08 13:53:17 +0800
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:49:36 -0600
commit311df498f892d7edc7beafd3ce59112165ca4df0 (patch)
tree202961e4d7bb38267f16535f79d1dc3885699e6c /include
parent418b755ad531ac8e83dc220a2e00b5598f6630a7 (diff)
downloadhqemu-311df498f892d7edc7beafd3ce59112165ca4df0.zip
hqemu-311df498f892d7edc7beafd3ce59112165ca4df0.tar.gz
cutils: add avx2 instruction optimization
buffer_find_nonzero_offset() is a hot function during live migration. Now it use SSE2 instructions for optimization. For platform supports AVX2 instructions, use AVX2 instructions for optimization can help to improve the performance of buffer_find_nonzero_offset() about 30% comparing to SSE2. Live migration can be faster with this optimization, the test result shows that for an 8GiB RAM idle guest just boots, this patch can help to shorten the total live migration time about 6%. This patch use the ifunc mechanism to select the proper function when running, for platform supports AVX2, execute the AVX2 instructions, else, execute the original instructions. Signed-off-by: Liang Li <liang.z.li@intel.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Suggested-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1457416397-26671-3-git-send-email-liang.z.li@intel.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu-common.h8
1 files changed, 1 insertions, 7 deletions
diff --git a/include/qemu-common.h b/include/qemu-common.h
index fd69ef1..f92fe9a 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -476,13 +476,7 @@ void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
#endif
#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8
-static inline bool
-can_use_buffer_find_nonzero_offset(const void *buf, size_t len)
-{
- return (len % (BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR
- * sizeof(VECTYPE)) == 0
- && ((uintptr_t) buf) % sizeof(VECTYPE) == 0);
-}
+bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len);
size_t buffer_find_nonzero_offset(const void *buf, size_t len);
/*
OpenPOWER on IntegriCloud