HomeFreeBSD

Reimplement futexes.
rS191719Unpublished

Unpublished Commit ยท Learn More

No further details are available.

Description

Reimplement futexes.
Old implemention used Giant to protect the kernel data structures,
but at the same time called malloc(M_WAITOK), that could cause the
calling thread to sleep and lost Giant protection. User-visible
result was the missed wakeup.

New implementation uses one sx lock per futex. The sx protects
the futex structures and allows to sleep while copyin or copyout
are performed.

Unlike linux, we return EINVAL when FUTEX_CMP_REQUEUE operation
is requested and either caller specified futexes are equial or
second futex already exists. This is acceptable since the situation
can only occur from the application error, and glibc falls back to
old FUTEX_WAKE operation when FUTEX_CMP_REQUEUE returns an error.

Approved by: kib (mentor)
MFC after: 1 month

Details

Provenance
dchaginAuthored on
Parents
rS191718: Limit scope of acquisition of INP_RLOCK for multicast input filter
Branches
Unknown
Tags
Unknown

Event Timeline