]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
futex: Simplify futex_lock_pi_atomic() and make it more robust
authorThomas Gleixner <tglx@linutronix.de>
Wed, 11 Jun 2014 20:45:41 +0000 (20:45 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 21 Jun 2014 20:26:24 +0000 (22:26 +0200)
commitaf54d6a1c3ad474bbc9893c9905022646be6092c
tree462e3a75dcc8858a272099bcf449c35f5ecea141
parent04e1b2e52b17195c9a1daa5935c55a4c8716095c
futex: Simplify futex_lock_pi_atomic() and make it more robust

futex_lock_pi_atomic() is a maze of retry hoops and loops.

Reduce it to simple and understandable states:

First step is to lookup existing waiters (state) in the kernel.

If there is an existing waiter, validate it and attach to it.

If there is no existing waiter, check the user space value

If the TID encoded in the user space value is 0, take over the futex
preserving the owner died bit.

If the TID encoded in the user space value is != 0, lookup the owner
task, validate it and attach to it.

Reduces text size by 128 bytes on x8664.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Cc: Kees Cook <kees@outflux.net>
Cc: wad@chromium.org
Cc: Darren Hart <darren@dvhart.com>
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1406131137020.5170@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/futex.c