Skip to content
Snippets Groups Projects
Commit e967bb87 authored by Avi Kivity's avatar Avi Kivity
Browse files

mutex: fairness

Without fairness, the concurrent alloc/free test fails quickly on smp, as
the allocator thread hogs the allocator mutex and quickly exhausts all memory.
While we could fix up the test to avoid this, fairness is a desirable quality,
so implement it.

We do so by adding and owner field, and having the unlocker transfer ownership
of the locked mutex instead of freeing it and letting the waiter race with
a newcomer.

Also simplify the wait list to a singly linked list.  There was some
corruption with the original implementation, and rather than fix it,
simplify it to a singly linked list which is all that is needed.
parent 81871be3
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment