Reimplement futex manager to use interruptible waits#501
Reimplement futex manager to use interruptible waits#501jstarks merged 8 commits intomicrosoft:mainfrom
Conversation
Update futex manager to use interruptible waits. As part of this, implement an intrusive linked list to avoid heap allocations in the futex path. The futex and linked list tests have been run against miri to check for uses of undefined behavior.
CvvT
left a comment
There was a problem hiding this comment.
LGTM! With this new design of WaitContext, things got simplifed a lot and futex now can support bitset mask. I only have a high level question: why we switched from hashmap to hashtable with linked list? You mentioned it avoids heap allocation. I wonder it is purely for optimization or has any other reasons.
As LiteBox becomes more general-purpose, I think we'll have to confront the reality that "panic on OOM" is not a viable strategy for some scenarios. So, if we can design some of our core data structures to avoid needing allocations in the first place, then the eventual conversion will be that much easier. It's probably OK to terminate the current process on OOM in cases where the contract doesn't allow us to return In this case, I had to change the data structure for the futex manager anyway--the old hash table was based on a single entry per futex, but with the new wait model (and to correctly support bitsets) we need an entry per waiter. Or at least a list of waiters per entry. So, I figured that we might as well switch to a data structure that's much more efficient for the use case, allocations or no--an external chaining hash table gives us good concurrency (lock per bucket instead of a global lock) while not requiring resizing under high load. It might be interesting to use this |
|
🤖 SemverChecks 🤖 Click for details |
Update futex manager to use interruptible waits. As part of this, implement an intrusive linked list to avoid heap
allocations in the futex path.
The futex and linked list tests have been run against miri to check for uses of undefined behavior.