Futex Comments-fix-ups (from Darren Hart)
PATCH 1/1 Futex Comments-fix-ups (from Darren Hart)
Hello Darren
As requested, I took your futex comment fix-ups from the following commits
9beba3c54dd180a26a1da2027cfbe9edfaf9c40ed8d88fbb186fe3ea37b2a58adb32413c98b59656d96ee56ce0582967fba9f3f0ac4503957147bea6d40d65c8dbdd39f0b64e043f6bd08f8a38f5519456ec1607b15b6a5f6de5aab14f16a763b88296fc
and cherry-picked them all for v2.6.31.4-rt14
Here they are all, put together as one patch.
Quoted 1 line
From
dc4073833a7543322f945c4bcf67bc106d7128f6Mon Sep 17 00:00:00 2001
From: Darren Hart <[email protected]>
Date: Thu, 24 Sep 2009 11:54:47 -0700
Subject: [PATCH] futex: Add memory barrier commentary to futex_wait_queue_me()
The memory barrier semantics of futex_wait_queue_me() are non-obvious. Add some commentary to try and clarify it.
LKML-Reference: <20090924185447.694.38948.stgit@Aeon>
--- kernel/futex.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
kernel/futex.c +6 -0
@@ -1638,6 +1638,12 @@ out:static void futex_wait_queue_me (struct futex_hash_bucket *hb,struct futex_q *q,struct hrtimer_sleeper *timeout) { +/* +* The task state is guaranteed to be set before another task can +* wake it. set_current_state() is implemented using set_mb() and +* queue_me() calls spin_unlock() upon completion, both serializing +* access to the hash list and forcing another memory barrier. +*/ set_current_state (TASK_INTERRUPTIBLE );queue_me (q, hb);
Signature · 1 line
1.6.0.6
Quoted 1 line
From
6575a45a2ed6bad78390cdfd2668fbbaceb6956aMon Sep 17 00:00:00 2001
From: Darren Hart <[email protected]>
Date: Mon, 21 Sep 2009 22:30:22 -0700
Subject: [PATCH] futex: Make function kernel-doc commentary consistent
Make the existing function kernel-doc consistent throughout futex.c, following Documentation/kernel-doc-nano-howto.txt as closely as possible.
When unsure, at least be consistent within futex.c.
LKML-Reference: <20090922053022.8717.13339.stgit@Aeon>
--- kernel/futex.c | 41 +++++++++++++++++++++-------------------- 1 files changed, 21 insertions(+), 20 deletions(-)
kernel/futex.c +21 -20
83 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Quoted 1 line
From
bfe470aa42687965162cb68219ffd583f628cac8Mon Sep 17 00:00:00 2001
From: Darren Hart <[email protected]>
Date: Mon, 21 Sep 2009 22:30:15 -0700
Subject: [PATCH] futex: Correct queue_me and unqueue_me commentary
The queue_me/unqueue_me commentary is oddly placed and out of date. Clean it up and correct the inaccurate bits.
LKML-Reference: <20090922053015.8717.71713.stgit@Aeon>
--- kernel/futex.c | 41 +++++++++++++++++++++++++++++------------ 1 files changed, 29 insertions(+), 12 deletions(-)
kernel/futex.c +29 -12
54 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Quoted 1 line
From
176b6c836c722fdeb50ba33c24a009b77708209aMon Sep 17 00:00:00 2001
From: Darren Hart <[email protected]>
Date: Mon, 21 Sep 2009 22:30:30 -0700
Subject: [PATCH] futex: Correct futex_q woken state commentary
Use kernel-doc format to describe struct futex_q.
Correct the wakeup definition to eliminate the statement about waking the waiter between the plist_del() and the q->lock_ptr = 0.
Note in the comment that PI futexes have a different definition of the woken state.
LKML-Reference: <20090922053029.8717.62798.stgit@Aeon>
--- kernel/futex.c | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-)
kernel/futex.c +16 -16
@@ -89,36 +89,36 @@ struct futex_pi_state {union futex_key key; }; -/* -* We use this hashed waitqueue instead of a normal wait_queue_t, so +/** +* struct futex_q - The hashed futex queue entry, one per waiting task +* @task: the task waiting on the futex +* @lock_ptr: the hash bucket lock +* @key: the key the futex is hashed on +* @pi_state: optional priority inheritance state +* @rt_waiter: rt_waiter storage for use with requeue_pi +* @requeue_pi_key: the requeue_pi target futex key +* @bitset: bitset for the optional bitmasked wakeup +* +* We use this hashed waitqueue, instead of a normal wait_queue_t, so * we can wake only the relevant ones (hashed queues may be shared). * * A futex_q has a woken state, just like tasks have TASK_RUNNING. * It is considered woken when plist_node_empty(&q->list) || q->lock_ptr == 0. * The order of wakup is always to make the first condition true, then -* wake up q->waiter, then make the second condition true. +* the second. +* +* PI futexes are typically woken before they are removed from the hash list via +* the rt_mutex code. See unqueue_me_pi(). */ struct futex_q {struct plist_node list; -/* Waiter reference */ -struct task_struct *task; -/* Which hash list lock to use: */ +struct task_struct *task;spinlock_t *lock_ptr; - -/* Key which the futex is hashed on: */ union futex_key key; - -/* Optional priority inheritance state: */ struct futex_pi_state *pi_state; - -/* rt_waiter storage for requeue_pi: */ struct rt_mutex_waiter *rt_waiter; - -/* The expected requeue pi target futex key: */ union futex_key *requeue_pi_key; - -/* Bitset for the optional bitmasked wakeup */ u32 bitset; };
Signature · 1 line
1.6.0.6
Quoted 1 line
From
0694a339cdbd4bb41a1699d6aa9d1671baae1edcMon Sep 17 00:00:00 2001
From: Darren Hart <[email protected]>
Date: Mon, 21 Sep 2009 22:29:59 -0700
Subject: [PATCH] futex: Correct futex_wait_requeue_pi() commentary
Correct various typos and formatting inconsistencies in the commentary of futex_wait_requeue_pi().
LKML-Reference: <20090922052958.8717.21932.stgit@Aeon>
--- kernel/futex.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
kernel/futex.c +3 -3
@@ -2136,12 +2136,12 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,/** * futex_wait_requeue_pi() - Wait on uaddr and take uaddr2 -* @uaddr: the futex we initialyl wait on (non-pi) +* @uaddr: the futex we initially wait on (non-pi) * @fshared: whether the futexes are shared (1) or not (0). They must be * the same type, no requeueing from private to shared, etc. * @val: the expected value of uaddr * @abs_time: absolute timeout -* @bitset: 32 bit wakeup bitset set by userspace, defaults to all. +* @bitset: 32 bit wakeup bitset set by userspace, defaults to all * @clockrt: whether to use CLOCK_REALTIME (1) or CLOCK_MONOTONIC (0) * @uaddr2: the pi futex we will take prior to returning to user-space *
@@ -2269,7 +2269,7 @@ retry: res =fixup_owner (uaddr2, fshared, &q, !ret);/* * If fixup_owner() returned an error, proprogate that. If it -* acquired the lock, clear our -ETIMEDOUT or -EINTR. +* acquired the lock, clear -ETIMEDOUT or -EINTR. */ if (res) ret = (res <0 ) ? res :0 ;
Signature · 1 line
1.6.0.6