Repository navigation
qemu: lock guest memory for x86_64 guests on Intel - #8049
Merged
Merged
Conversation
osy
marked this pull request as ready for review
November 12, 2026 03:58
Without -overcommit mem-lock=on, macOS compresses and swaps guest RAM under memory pressure, and the guest then stalls on page faults when it touches that memory again. For x86_64 guests that use the hypervisor on an Intel Mac, pass -overcommit mem-lock=on. It is a per-VM setting under QEMU > Tweaks, stored as MemoryLock and on by default. This needs utmapp/qemu#19: mlockall() returns ENOSYS on macOS, so without it QEMU exits with "locking memory failed". With it, QEMU locks each guest RAM mapping on HVF and only warns if a lock fails. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Josh Guyette <joshguyette@yahoo.com>
osy
force-pushed
the
macos/intel-hvf-memory-lock
branch
from
November 12, 2026 03:59
e026c91 to
5a25d0a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on utmapp/qemu#19.
mlockall()returnsENOSYSon macOS, so without that QEMU change,-overcommit mem-lock=onmakes QEMU exit with "locking memory failed". With it, QEMU locks each guest RAM mapping on HVF and only warns if a lock fails, so the VM still starts on a Mac without enough free memory. This is a draft until that lands.Part of #8046.
Without a memory lock, macOS compresses and swaps guest RAM under memory pressure, and the guest then stalls on page faults when it touches that memory again. That shows up as stutter and audio dropouts in Windows, mostly on Macs with 8–16 GB.
For x86_64 guests that use the hypervisor on an Intel Mac, this passes
-overcommit mem-lock=on. It is a per-VM setting, QEMU → Tweaks → Lock guest memory, stored asMemoryLockand on by default. The toggle is shown only for x86_64 guests that use the hypervisor in an Intel build.Testing: Tested by a human on macOS 15.8.1, MacBook Pro 14,3 (2017, i7-7700HQ), with an 8 GB Windows 11 x64 guest, using a QEMU with utmapp/qemu#19. It was tested in a combined build with the other Intel changes from #8046. The VM starts with the lock in place, and the QEMU command line has
-overcommit mem-lock=on. I didn't measure its effect on its own.I have read the AI contribution guidelines and have followed them to the best of my ability.
The author acknowledges that this change has been tested and/or reviewed by a human in accordance with UTM's AI contribution guidelines.