watch: VICTORY_MAP_LOCK_FINE=1 takes the mapping lock by range (off by default) #304
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/304"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from avatarmanz/VIctory-7900XTX. Originally posted by zocram4cc on 2026-11-26T15:19:25Z.
What
VICTORY_MAP_LOCK_FINE=1takes the title-memory mapping lock by address range instead of one RwLock for the whole address space. Off by default; with the switch off the old lock is used unchanged.Why
The mapping lock serialises every reader and writer of title memory, so writers of unrelated memory made draw-side readers wait for no reason. Range-scoped announcements let disjoint readers proceed while a change is in flight.
Credit: design from Op-lite/victory-scarlett 7c8f019 (scarlett-local, GPL-3.0). Cherry-picked from our
perf/v7900-final(commit631712fis 19dcdaf onv7900/main), original author kept.Measured
Series S, release build, Proton on Linux, 300 s of world time per run. Two runs per arm; the arms differ only in
VICTORY_MAP_LOCK_FINE. Other test switches were the same in both arms.Linux/Proton only measured, Windows untested.
Tests
watch::fine_tests: a reader of a disjoint range goes on during a change; an overlapping reader waits; a writer is not starved by a stream of overlapping readers; an unranged reader or writer excludes as the old lock did; with the switch off a ranged change still excludes a read of other memory.Run under Proton on this head (
631712f), one test exe,--test-threads 1:watch::fine_tests(5):VICTORY_MAP_LOCK_FINEunset: 5 pass;VICTORY_MAP_LOCK_FINE=1: 5 pass.watch::(53 tests, the 5 above included): unset: 50 pass, 3 fail;=1: 50 pass, 3 fail. The same 3 fail in both, and they are the Wine-only failures that also fail on upstream:holes_are_known_until_the_runtime_tells,no_mapping_is_lost_between_askers,what_is_left_alone_is_no_known_hole.Build
cargo xwin build --profile release -p victory --target x86_64-pc-windows-msvc: passes on this branch.AI-assisted (Claude Code).
Imported from avatarmanz/VIctory-7900XTX. Originally posted by UwUCammie on 2026-11-26T16:17:24Z.
I found some extra work on the default path in
631712f0. Both batched mapping calls buildaffected_opswhile holding the physical mapping mutex, then the whole-address-space lock discards the result. The two single-range callers also walk the view map with the switch off.I sent a small fix against your PR branch. With the change, the collector runs zero times when the switch is off and once when it’s on. All six mapping-lock tests passed in each mode under Wine 11.22.
Imported from avatarmanz/VIctory-7900XTX. Originally posted by zocram4cc on 2026-11-26T17:01:40Z.
Thanks @UwUCammie, merged your fix into this branch (
68a7a66). Re-checked under Proton: fine_tests + mapping_tests 7/7 with VICTORY_MAP_LOCK_FINE unset and =1.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.