futex.2: Clarify "total ordering" a little

Comments from Davidlohr:

    So there are two things here regarding ordering. One is the
    most obvious which is ordered due to the taking/dropping the
    hb spinlock. Secondly, its the cases which Peter brought up
    a while ago that involves atomic futex ops futex_atomic_*(),
    which do not have clearly defined semantics, and you get
    inconsistencies with certain archs (tile being the worst
    iirc).

    But anyway, the important thing users need to know about is
    that the atomic futex operation must be totally ordered wrt
    any other user tasks that are trying to access that address.
    This is not necessarily the case for kernel ops. Peter
    illustrates this nicely with lock stealing example; (see
    https://lkml.org/lkml/2015/8/26/596).

    Internally, I believe we decided that making it fully ordered
    (as opposed to making use of implicit barriers for
    ACQUIRE/RELEASE), so you'd end up having an MB ll/sc MB kind of
    setup.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Reported-by: Davidlohr Bueso <dave@stgolabs.net>
This commit is contained in:
Michael Kerrisk 2015-12-16 16:35:30 +01:00
parent 4975d6af79
commit 0fb87d16ac
1 changed files with 5 additions and 5 deletions

View File

@ -80,11 +80,11 @@ calling thread supplied (as one of the arguments of the
call) as the expected value of the futex word.
The loading of the futex word's value,
the comparison of that value with the expected value,
and the actual blocking will happen atomically and totally
ordered with respect to concurrently executing futex
operations on the same futex word.
(Here, "totally ordered" refers to the mathematical notion of
a strict total order.)
and the actual blocking will happen atomically and will be totally
ordered with respect to concurrent operations performed by other threads
on the same futex word.
.\" (Here, "totally ordered" refers to the mathematical notion of
.\" a strict total order.)
Thus, the futex word is used to connect the synchronization in user space
with the implementation of blocking by the kernel.
Analogously to an atomic