Repository navigation
ntsync: budgeted wakes after unlock, SIGUSR1 deferral through a lock flag (test build) - #138
Draft
utkarshdalal wants to merge 3 commits into
Draft
utkarshdalal wants to merge 3 commits into
utkarshdalal wants to merge 3 commits into
Conversation
added 3 commits
November 16, 2026 11:13
…c-android to wakes after unlock - ci: pin ntsync-android 6342614 (GameNative/ntsync-android#1): release wakes are issued after the region unlock, and the library takes a per-thread lock flag from the host instead of masking SIGUSR1. - common/dlls_ntdll_unix_server_c_ntsync_lock_flag.patch: ntdll_thread_data gets ntsync_lock_flag; server_init_process registers it with ntsync_set_lock_flag_hook on aarch64 and x86_64. - arm64ec/dlls_ntdll_unix_signal_arm64_c_ntsync_lock_flag.patch, x86_64/dlls_ntdll_unix_signal_x86_64_c_ntsync_lock_flag.patch: usr1_handler marks the signal pending and returns while the flag is set; the library re-raises it right after the unlock. - android/ntsync_android/ntsync_user.h synced with the library header.
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.
Test build for GameNative/ntsync-android#1. It pins ntsync-android to 6342614 and adds a Wine patch for that library's SIGUSR1 cooperation.
What changes
common/dlls_ntdll_unix_server_c_ntsync_lock_flag.patch.ntdll_thread_datagetsntsync_lock_flag. When userspace ntsync is in use,server_init_processregisters it withntsync_set_lock_flag_hook(aarch64 and x86_64 only).arm64ec/dlls_ntdll_unix_signal_arm64_c_ntsync_lock_flag.patchandx86_64/dlls_ntdll_unix_signal_x86_64_c_ntsync_lock_flag.patch. While the flag is set,usr1_handlermarks the suspend pending and returns. The library re-raises SIGUSR1 right after it releases the lock. Before this, the library blocked SIGUSR1 around every lock acquisition, which cost two sigprocmask syscalls each time.android/ntsync_android/ntsync_user.his synced with the library header.NTSYNC_WAKE_ALL=1still selects wake-all from the same build.Result on The Forest (Odin 3)
New Game, the same pad loop, measured about 3 minutes into gameplay. Each column is one run of this PR's build at a different library pin:
rt_sigprocmaskon the release pathpthread_mutex_unlockshareNtReleaseSemaphoreshareWhat did not change: the release share stays at about 30 %. The release path is now one futex wake per walk. However, the game took 2.3 times more walks per second than in the f465609 run, and it did more signal operations per frame in this scene. The futex wake itself is now the whole cost. The scenes differ between runs, so fps is not compared; this run measured 53–59 fps while moving.
SIGUSR1 deferral was exercised in game: 4 suspends landed inside the lock, were deferred and were delivered after it. No stuck waits and no blocked region lock were seen.
Before merge
Tag ntsync-android and pin the tag here instead of the commit.