This series introduces new qemu_prealloc_mem_with_timeout() api, which allows limiting the maximum amount of time to be spent on memory preallocation. It also adds prealloc statistics collection that is exposed via an optional timeout handler.
This new api is then utilized by hostmem for guest RAM preallocation controlled via new object properties called 'prealloc-timeout' and 'prealloc-timeout-fatal'. This is useful for limiting VM startup time on systems with unpredictable page allocation delays due to memory fragmentation or the backing storage. The timeout can be configured to either simply emit a warning and continue VM startup without having preallocated the entire guest RAM or just abort startup entirely if that is not acceptable for a specific use case. Daniil Tatianin (4): oslib: introduce new qemu_prealloc_mem_with_timeout() api backends/hostmem: move memory region preallocation logic into a helper backends/hostmem: add an ability to specify prealloc timeout backends/hostmem: add an ability to make prealloc timeout fatal backends/hostmem.c | 112 +++++++++++++++++++++++++++++++------- include/qemu/osdep.h | 19 +++++++ include/sysemu/hostmem.h | 3 ++ qapi/qom.json | 8 +++ util/oslib-posix.c | 114 +++++++++++++++++++++++++++++++++++---- util/oslib-win32.c | 9 ++++ 6 files changed, 238 insertions(+), 27 deletions(-) -- 2.25.1