From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Darren Hart <darren@dvhart.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Michael Kerrisk <mtk.manpages@googlemail.com>,
Davidlohr Bueso <dave@stgolabs.net>, Chris Mason <clm@fb.com>,
"Carlos O'Donell" <carlos@redhat.com>,
Torvald Riegel <triegel@redhat.com>,
Eric Dumazet <edumazet@google.com>
Subject: [RFC patch 6/7] futex.2: Document attached mode
Date: Sat, 02 Apr 2016 11:09:20 -0000 [thread overview]
Message-ID: <20160402110036.030897949@linutronix.de> (raw)
In-Reply-To: 20160402095108.894519835@linutronix.de
[-- Attachment #1: futex.2--Document-attached-mode.patch --]
[-- Type: text/plain, Size: 3620 bytes --]
At least an attempt to document the futex attached mode extension.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
man2/futex.2 | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 75 insertions(+), 3 deletions(-)
--- a/man2/futex.2
+++ b/man2/futex.2
@@ -138,8 +138,8 @@ Besides the basic wait and wake-up futex
futex operations aimed at supporting more complex use cases.
Note that
-no explicit initialization or destruction is necessary to use futexes;
-the kernel maintains a futex
+no explicit initialization or destruction is necessary to use futexes
+except when using futexes in attached mode; the kernel maintains a futex
(i.e., the kernel-internal implementation artifact)
only while operations such as
.BR FUTEX_WAIT ,
@@ -253,6 +253,12 @@ as a relative time,
measured against the
.BR CLOCK_MONOTONIC
clock.
+.TP
+.BR FUTEX_ATTACHED " (since Linux ?.?.?)"
+This option can be employed with all futex operations. It tells the kernel
+that the futex operates in attached mode. See the futex_op
+.BR FUTEX_ATTACH
+for further explanation.
.PP
The operation specified in
.I futex_op
@@ -767,6 +773,63 @@ operations correspond to
and
.BR FUTEX_WAKE_BITSET
operations where the bit masks are all ones.
+
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.TP
+.BR FUTEX_ATTACH " (since Linux ?.?.?)"
+This operation attaches the futex on the futex address provided by the
+.IR uaddr
+argument.
+
+This operation tells the kernel that the thread is going to operate on that
+futex and therefor it should create a kernel side state for it. This state is
+used in further futex operations instead of the global hash which is used
+without that optimization.
+
+There are two advantages for using attached futexes. Potential hash collisions
+on the global hash are avoided. The kernel state which replaces the global
+hash for attached futexes is allocated on the node on which the thread runs
+and therefor avoids cross node memory access.
+
+For this operation and all subsequent operations on the futex the flag
+.BR FUTEX_ATTACHED
+must be ORed to the
+.I futex_op
+
+The
+.IR val ,
+.IR timeout ,
+.IR uaddr2
+and
+.I val3
+arguments are ignored.
+
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.TP
+.BR FUTEX_DETACH " (since Linux ?.?.?)"
+This operation detaches the futex on the futex address provided by the
+.I uaddr
+argument from the kernel state.
+
+This operation reverses a previous
+.BR FUTEX_ATTACH
+operation.
+
+If the caller is the last user of the kernel side state, the kernel side state
+is destroyed.
+
+The
+.IR val ,
+.IR timeout ,
+.IR uaddr2
+and
+.I val3
+arguments are ignored.
+
.\"
.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"
@@ -1402,6 +1465,10 @@ While requeueing a waiter to the PI fute
.IR uaddr2 ,
the kernel detected a deadlock.
.TP
+.B EEXIST
+.RB ( FUTEX_ATTACH )
+Operation was attempted on a already attached futex.
+.TP
.B EFAULT
A required pointer argument (i.e.,
.IR uaddr ,
@@ -1550,13 +1617,18 @@ Invalid argument.
.BR ENOMEM
.RB ( FUTEX_LOCK_PI ,
.BR FUTEX_TRYLOCK_PI ,
-.BR FUTEX_CMP_REQUEUE_PI )
+.BR FUTEX_CMP_REQUEUE_PI,
+.BR FUTEX_ATTACH )
The kernel could not allocate memory to hold state information.
.TP
.B ENFILE
.RB ( FUTEX_FD )
The system-wide limit on the total number of open files has been reached.
.TP
+.B ENOSPC
+.RB ( FUTEX_ATTACH )
+Operation failed because the limit of attached futexes has been reached.
+.TP
.B ENOSYS
Invalid operation specified in
.IR futex_op .
prev parent reply other threads:[~2016-04-02 11:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-02 11:09 [RFC patch 0/7] futex: Add support for attached futexes Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 1/7] futex: Provide helpers for hash bucket add/remove Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 2/7] futex: Add some more function commentry Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 3/7] futex: Make key init a helper function Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 4/7] futex: Add support for attached futexes Thomas Gleixner
2016-04-02 16:26 ` Peter Zijlstra
2016-04-02 18:01 ` Thomas Gleixner
2016-04-02 16:29 ` Peter Zijlstra
2016-04-03 9:59 ` Thomas Gleixner
2016-04-02 18:19 ` Andy Lutomirski
2016-04-03 9:57 ` Thomas Gleixner
2016-04-03 13:18 ` Andy Lutomirski
2016-04-03 15:56 ` Thomas Gleixner
2016-04-03 16:11 ` Andy Lutomirski
2016-04-02 23:48 ` Rasmus Villemoes
2016-04-03 10:05 ` Thomas Gleixner
2016-04-03 11:16 ` Ingo Molnar
2016-04-03 11:30 ` Linus Torvalds
2016-04-05 7:44 ` Torvald Riegel
2016-04-05 15:58 ` Carlos O'Donell
2016-04-02 11:09 ` [RFC patch 5/7] perf/bench/futex-hash: Support " Thomas Gleixner
2016-04-02 11:09 ` [RFC patch 7/7] [PATCH] glibc: nptl: Add support for attached pthread_mutexes Thomas Gleixner
2016-04-02 16:30 ` Peter Zijlstra
2016-04-02 16:32 ` Peter Zijlstra
2016-04-03 10:08 ` Thomas Gleixner
2016-04-02 11:09 ` Thomas Gleixner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160402110036.030897949@linutronix.de \
--to=tglx@linutronix.de \
--cc=bigeasy@linutronix.de \
--cc=carlos@redhat.com \
--cc=clm@fb.com \
--cc=darren@dvhart.com \
--cc=dave@stgolabs.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mtk.manpages@googlemail.com \
--cc=peterz@infradead.org \
--cc=triegel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox