Re: [PATCH v4 00/15] Add futex2 syscalls

From: Zebediah Figura
Date: Fri Jun 04 2021 - 00:52:55 EST


On 6/3/21 2:59 PM, André Almeida wrote:
** The wait on multiple problem

The use case lies in the Wine implementation of the Windows NT interface
WaitMultipleObjects. This Windows API function allows a thread to sleep
waiting on the first of a set of event sources (mutexes, timers, signal,
console input, etc) to signal. Considering this is a primitive
synchronization operation for Windows applications, being able to quickly
signal events on the producer side, and quickly go to sleep on the
consumer side is essential for good performance of those running over Wine.


I know this is part of the cover letter, but I really do want to clarify that this isn't really accurate. The use case that this is referring to is not "the Wine implementation of WaitForMultipleObjects", it is an out-of-tree implementation of WaitForMultipleObjects that provides improved performance compared to the in-tree implementation.

This is especially salient because:

(1) this out-of-tree implementation is only in a small handful of cases any more performant than a different out-of-tree implementation which uses eventfd and poll() instead;

(2) these implementations will remain out-of-tree due to compatibility and robustness problems;

(3) I believe there is potential for an upstreamable implementation which does not rely on futex or futex2.