aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-03-11 05:51:22 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-03-11 06:23:07 -0500
commitc0c9ed15042ceac7c485813012a0a97316101b57 (patch)
treec89272252b44c8330854bee7291e81252d7715f5 /kernel/futex.c
parent8fe8f545c6d753ead15e1f4919d39e8f9bb49629 (diff)
futex: Avoid redudant evaluation of task_pid_vnr()
The result is not going to change under us, so no need to reevaluate this over and over. Seems to be a leftover from the mechanical mass conversion of task->pid to task_pid_vnr(tsk). Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 3184d3b9cadf..773815465bac 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -674,7 +674,7 @@ static int futex_lock_pi_atomic(u32 __user *uaddr, struct futex_hash_bucket *hb,
674 struct task_struct *task, int set_waiters) 674 struct task_struct *task, int set_waiters)
675{ 675{
676 int lock_taken, ret, ownerdied = 0; 676 int lock_taken, ret, ownerdied = 0;
677 u32 uval, newval, curval; 677 u32 uval, newval, curval, vpid = task_pid_vnr(task);
678 678
679retry: 679retry:
680 ret = lock_taken = 0; 680 ret = lock_taken = 0;
@@ -684,7 +684,7 @@ retry:
684 * (by doing a 0 -> TID atomic cmpxchg), while holding all 684 * (by doing a 0 -> TID atomic cmpxchg), while holding all
685 * the locks. It will most likely not succeed. 685 * the locks. It will most likely not succeed.
686 */ 686 */
687 newval = task_pid_vnr(task); 687 newval = vpid;
688 if (set_waiters) 688 if (set_waiters)
689 newval |= FUTEX_WAITERS; 689 newval |= FUTEX_WAITERS;
690 690
@@ -696,7 +696,7 @@ retry:
696 /* 696 /*
697 * Detect deadlocks. 697 * Detect deadlocks.
698 */ 698 */
699 if ((unlikely((curval & FUTEX_TID_MASK) == task_pid_vnr(task)))) 699 if ((unlikely((curval & FUTEX_TID_MASK) == vpid)))
700 return -EDEADLK; 700 return -EDEADLK;
701 701
702 /* 702 /*
@@ -723,7 +723,7 @@ retry:
723 */ 723 */
724 if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) { 724 if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
725 /* Keep the OWNER_DIED bit */ 725 /* Keep the OWNER_DIED bit */
726 newval = (curval & ~FUTEX_TID_MASK) | task_pid_vnr(task); 726 newval = (curval & ~FUTEX_TID_MASK) | vpid;
727 ownerdied = 0; 727 ownerdied = 0;
728 lock_taken = 1; 728 lock_taken = 1;
729 } 729 }
@@ -2047,9 +2047,9 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags)
2047{ 2047{
2048 struct futex_hash_bucket *hb; 2048 struct futex_hash_bucket *hb;
2049 struct futex_q *this, *next; 2049 struct futex_q *this, *next;
2050 u32 uval;
2051 struct plist_head *head; 2050 struct plist_head *head;
2052 union futex_key key = FUTEX_KEY_INIT; 2051 union futex_key key = FUTEX_KEY_INIT;
2052 u32 uval, vpid = task_pid_vnr(current);
2053 int ret; 2053 int ret;
2054 2054
2055retry: 2055retry:
@@ -2058,7 +2058,7 @@ retry:
2058 /* 2058 /*
2059 * We release only a lock we actually own: 2059 * We release only a lock we actually own:
2060 */ 2060 */
2061 if ((uval & FUTEX_TID_MASK) != task_pid_vnr(current)) 2061 if ((uval & FUTEX_TID_MASK) != vpid)
2062 return -EPERM; 2062 return -EPERM;
2063 2063
2064 ret = get_futex_key(uaddr, flags & FLAGS_SHARED, &key); 2064 ret = get_futex_key(uaddr, flags & FLAGS_SHARED, &key);
@@ -2074,7 +2074,7 @@ retry:
2074 * anyone else up: 2074 * anyone else up:
2075 */ 2075 */
2076 if (!(uval & FUTEX_OWNER_DIED)) 2076 if (!(uval & FUTEX_OWNER_DIED))
2077 uval = cmpxchg_futex_value_locked(uaddr, task_pid_vnr(current), 0); 2077 uval = cmpxchg_futex_value_locked(uaddr, vpid, 0);
2078 2078
2079 2079
2080 if (unlikely(uval == -EFAULT)) 2080 if (unlikely(uval == -EFAULT))
@@ -2083,7 +2083,7 @@ retry:
2083 * Rare case: we managed to release the lock atomically, 2083 * Rare case: we managed to release the lock atomically,
2084 * no need to wake anyone else up: 2084 * no need to wake anyone else up:
2085 */ 2085 */
2086 if (unlikely(uval == task_pid_vnr(current))) 2086 if (unlikely(uval == vpid))
2087 goto out_unlock; 2087 goto out_unlock;
2088 2088
2089 /* 2089 /*