Skip to content

Commit

Permalink
futex_requeue_pi optimization
Browse files Browse the repository at this point in the history
This patch provides the futex_requeue_pi functionality, which allows some
threads waiting on a normal futex to be requeued on the wait-queue of a
PI-futex.

This provides an optimization, already used for (normal) futexes, to be used
with the PI-futexes.

This optimization is currently used by the glibc in pthread_broadcast, when
using "normal" mutexes.  With futex_requeue_pi, it can be used with
PRIO_INHERIT mutexes too.

Signed-off-by: Pierre Peiffer <pierre.peiffer@bull.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Pierre Peiffer authored and Linus Torvalds committed May 9, 2007
1 parent c19384b commit d0aa7a7
Show file tree
Hide file tree
Showing 5 changed files with 540 additions and 88 deletions.
9 changes: 8 additions & 1 deletion include/linux/futex.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ union ktime;
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_CMP_REQUEUE_PI 9

/*
* Support for robust futexes: the kernel cleans up held futexes at
Expand Down Expand Up @@ -84,10 +85,15 @@ struct robust_list_head {
*/
#define FUTEX_OWNER_DIED 0x40000000

/*
* Some processes have been requeued on this PI-futex
*/
#define FUTEX_WAITER_REQUEUED 0x20000000

/*
* The rest of the robust-futex field is for the TID:
*/
#define FUTEX_TID_MASK 0x3fffffff
#define FUTEX_TID_MASK 0x0fffffff

/*
* This limit protects against a deliberately circular list.
Expand All @@ -111,6 +117,7 @@ handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi);
* We set bit 0 to indicate if it's an inode-based key.
*/
union futex_key {
u32 __user *uaddr;
struct {
unsigned long pgoff;
struct inode *inode;
Expand Down
Loading

0 comments on commit d0aa7a7

Please sign in to comment.