qemu/util
bauerchen 037fb5eb39 mem-prealloc: optimize large guest startup
[desc]:
    Large memory VM starts slowly when using -mem-prealloc, and
    there are some areas to optimize in current method;

    1、mmap will be used to alloc threads stack during create page
    clearing threads, and it will attempt mm->mmap_sem for write
    lock, but clearing threads have hold read lock, this competition
    will cause threads createion very slow;

    2、methods of calcuating pages for per threads is not well;if we use
    64 threads to split 160 hugepage,63 threads clear 2page,1 thread
    clear 34 page,so the entire speed is very slow;

    to solve the first problem,we add a mutex in thread function,and
    start all threads when all threads finished createion;
    and the second problem, we spread remainder to other threads,in
    situation that 160 hugepage and 64 threads, there are 32 threads
    clear 3 pages,and 32 threads clear 2 pages.

[test]:
    320G 84c VM start time can be reduced to 10s
    680G 84c VM start time can be reduced to 18s

Signed-off-by: bauerchen <bauerchen@tencent.com>
Reviewed-by: Pan Rui <ruippan@tencent.com>
Reviewed-by: Ivan Ren <ivanren@tencent.com>
[Simplify computation of the number of pages per thread. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-02-25 09:18:01 +01:00
..
aio-posix.c aio-posix: make AioHandler dispatch O(1) with epoll 2020-02-22 08:26:47 +00:00
aio-wait.c
aio-win32.c
aiocb.c
async.c util/async: make bh_aio_poll() O(1) 2020-02-22 08:26:47 +00:00
atomic64.c
base64.c
bitmap.c
bitops.c
buffer.c
bufferiszero.c
cacheinfo.c util/cacheinfo: fix crash when compiling with uClibc 2020-01-21 14:18:12 -10:00
compatfd.c
coroutine-sigaltstack.c
coroutine-ucontext.c
coroutine-win32.c
crc32c.c
cutils.c util/cutils: Turn FIXME comment into QEMU_BUILD_BUG_ON() 2019-12-18 12:26:25 +01:00
dbus.c util: add dbus helper unit 2020-01-06 18:41:32 +04:00
drm.c
envlist.c
error.c error: make Error **errp const where it is appropriate 2019-12-18 08:36:16 +01:00
event_notifier-posix.c
event_notifier-win32.c
fifo8.c
filemonitor-inotify.c
filemonitor-stub.c
getauxval.c
guest-random.c replay: record and replay random number sources 2020-01-07 12:08:39 +01:00
hbitmap.c
hexdump.c
host-utils.c
id.c chardev: generate an internal id when none given 2020-01-07 16:50:09 +04:00
iov.c
iova-tree.c
keyval.c
lockcnt.c
log.c linux-user: Use `qemu_log' for strace 2020-02-19 11:17:40 +01:00
main-loop.c
Makefile.objs mem: move nvdimm_device_list to utilities 2020-02-21 09:15:03 +11:00
memfd.c
mmap-alloc.c
module.c module: check module wasn't already initialized 2020-02-22 08:26:47 +00:00
notify.c
nvdimm-utils.c mem: move nvdimm_device_list to utilities 2020-02-21 09:15:03 +11:00
osdep.c osdep: add qemu_unlink() 2020-01-02 16:29:32 +04:00
oslib-posix.c mem-prealloc: optimize large guest startup 2020-02-25 09:18:01 +01:00
oslib-win32.c
pagesize.c
path.c
qdist.c
qemu-co-shared-resource.c
qemu-config.c
qemu-coroutine-io.c
qemu-coroutine-lock.c
qemu-coroutine-sleep.c
qemu-coroutine.c
qemu-error.c error: Fix -msg timestamp default 2019-12-18 08:36:15 +01:00
qemu-openpty.c
qemu-option.c
qemu-print.c
qemu-progress.c
qemu-sockets.c
qemu-thread-common.h
qemu-thread-posix.c
qemu-thread-win32.c
qemu-timer-common.c Remove support for CLOCK_MONOTONIC not being defined 2020-02-12 16:23:01 +01:00
qemu-timer.c
qht.c
qsp.c qsp: Use WITH_RCU_READ_LOCK_GUARD 2019-12-17 19:33:52 +01:00
range.c
rcu.c
readline.c
stats64.c
sys_membarrier.c
systemd.c
thread-pool.c
throttle.c
timed-average.c
trace-events
unicode.c
uri.c
uuid.c
vfio-helpers.c Report stringified errno in VFIO related errors 2020-02-18 20:20:49 +01:00