mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
overcommit: introduce mem-lock=on-fault
Locking the memory without MCL_ONFAULT instantly prefaults any mmaped anonymous memory with a write-fault, which introduces a lot of extra overhead in terms of memory usage when all you want to do is to prevent kcompactd from migrating and compacting QEMU pages. Add an option to only lock pages lazily as they're faulted by the process by using MCL_ONFAULT if asked. Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru> Link: https://lore.kernel.org/r/20250212143920.1269754-5-d-tatianin@yandex-team.ru Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
cd2e472e54
commit
13057e064a
5 changed files with 45 additions and 14 deletions
|
@ -4632,21 +4632,25 @@ SRST
|
|||
ERST
|
||||
|
||||
DEF("overcommit", HAS_ARG, QEMU_OPTION_overcommit,
|
||||
"-overcommit [mem-lock=on|off][cpu-pm=on|off]\n"
|
||||
"-overcommit [mem-lock=on|off|on-fault][cpu-pm=on|off]\n"
|
||||
" run qemu with overcommit hints\n"
|
||||
" mem-lock=on|off controls memory lock support (default: off)\n"
|
||||
" mem-lock=on|off|on-fault controls memory lock support (default: off)\n"
|
||||
" cpu-pm=on|off controls cpu power management (default: off)\n",
|
||||
QEMU_ARCH_ALL)
|
||||
SRST
|
||||
``-overcommit mem-lock=on|off``
|
||||
``-overcommit mem-lock=on|off|on-fault``
|
||||
\
|
||||
``-overcommit cpu-pm=on|off``
|
||||
Run qemu with hints about host resource overcommit. The default is
|
||||
to assume that host overcommits all resources.
|
||||
|
||||
Locking qemu and guest memory can be enabled via ``mem-lock=on``
|
||||
(disabled by default). This works when host memory is not
|
||||
overcommitted and reduces the worst-case latency for guest.
|
||||
or ``mem-lock=on-fault`` (disabled by default). This works when
|
||||
host memory is not overcommitted and reduces the worst-case latency for
|
||||
guest. The on-fault option is better for reducing the memory footprint
|
||||
since it makes allocations lazy, but the pages still get locked in place
|
||||
once faulted by the guest or QEMU. Note that the two options are mutually
|
||||
exclusive.
|
||||
|
||||
Guest ability to manage power state of host cpus (increasing latency
|
||||
for other processes on the same host cpu, but decreasing latency for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue