Another day, another try and getting the long-awaited futex2 patches into the Linux Kernel with another version submitted.
For a quick reminder: this work from Collabora is designed to help Linux gaming for both native games and Windows games run through Wine and the Steam Play Proton compatibility layers. This work was cut-down to size in the hopes of getting the simpler work actually upstreamed into the Linux Kernel. The idea is to basically better match Windows behaviour to improve compatibility, as the developer notes:
The use case of this syscall is to allow low level locking libraries to wait for multiple locks at the same time. This is specially useful for emulating Windows' WaitForMultipleObjects. A futex_waitv()-based solution has been used for some time at Proton's Wine (a compatibility layer to run Windows games on Linux). Compared to a solution that uses eventfd(), futex was able to reduce CPU utilization for games, and even increase frames per second for some games. This happens because eventfd doesn't scale very well for a huge number of read, write and poll calls compared to futex. Native game engines will benefit of this as well, given that this wait pattern is common for games.
This is what has changed in the new version:
- Added a clockid argument in sys_futex_waitv()
- This required some changes in the timeout init
- Added test for wouldblock
- Added documentation file
- Fixed error path order for futex_wait_multiple()
- Return error if FUTEX_32 is not set for a waiter
- Extended futex_waitv() selftest to cover error paths like this
Coming as a result of feedback received at the recent Linux Plumbers Conference 2021 where Collabora developer André Almeida gave an overview of what it is and why it's needed:
Direct Link
See more from me