aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-12-19 15:07:39 -0500
committerThomas Gleixner <tglx@linutronix.de>2015-12-20 06:43:24 -0500
commit29e9ee5d48c35d6cf8afe09bdf03f77125c9ac11 (patch)
tree6cd31caa45bad2cdfb8c4939e4a831425e9b4279 /kernel/futex.c
parentfb75a4282d0d9a3c7c44d940582c2d226cf3acfb (diff)
futex: Rename free_pi_state() to put_pi_state()
free_pi_state() is confusing as it is in fact only freeing/caching the pi state when the last reference is gone. Rename it to put_pi_state() which reflects better what it is doing. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Darren Hart <darren@dvhart.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Bhuvanesh_Surachari@mentor.com Cc: Andy Lowe <Andy_Lowe@mentor.com> Link: http://lkml.kernel.org/r/20151219200607.259636467@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 24fbc7765828..f1581ff47122 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -725,9 +725,12 @@ static struct futex_pi_state * alloc_pi_state(void)
725} 725}
726 726
727/* 727/*
728 * Drops a reference to the pi_state object and frees or caches it
729 * when the last reference is gone.
730 *
728 * Must be called with the hb lock held. 731 * Must be called with the hb lock held.
729 */ 732 */
730static void free_pi_state(struct futex_pi_state *pi_state) 733static void put_pi_state(struct futex_pi_state *pi_state)
731{ 734{
732 if (!pi_state) 735 if (!pi_state)
733 return; 736 return;
@@ -1729,7 +1732,7 @@ retry_private:
1729 case 0: 1732 case 0:
1730 break; 1733 break;
1731 case -EFAULT: 1734 case -EFAULT:
1732 free_pi_state(pi_state); 1735 put_pi_state(pi_state);
1733 pi_state = NULL; 1736 pi_state = NULL;
1734 double_unlock_hb(hb1, hb2); 1737 double_unlock_hb(hb1, hb2);
1735 hb_waiters_dec(hb2); 1738 hb_waiters_dec(hb2);
@@ -1746,7 +1749,7 @@ retry_private:
1746 * exit to complete. 1749 * exit to complete.
1747 * - The user space value changed. 1750 * - The user space value changed.
1748 */ 1751 */
1749 free_pi_state(pi_state); 1752 put_pi_state(pi_state);
1750 pi_state = NULL; 1753 pi_state = NULL;
1751 double_unlock_hb(hb1, hb2); 1754 double_unlock_hb(hb1, hb2);
1752 hb_waiters_dec(hb2); 1755 hb_waiters_dec(hb2);
@@ -1815,7 +1818,7 @@ retry_private:
1815 } else if (ret) { 1818 } else if (ret) {
1816 /* -EDEADLK */ 1819 /* -EDEADLK */
1817 this->pi_state = NULL; 1820 this->pi_state = NULL;
1818 free_pi_state(pi_state); 1821 put_pi_state(pi_state);
1819 goto out_unlock; 1822 goto out_unlock;
1820 } 1823 }
1821 } 1824 }
@@ -1824,7 +1827,7 @@ retry_private:
1824 } 1827 }
1825 1828
1826out_unlock: 1829out_unlock:
1827 free_pi_state(pi_state); 1830 put_pi_state(pi_state);
1828 double_unlock_hb(hb1, hb2); 1831 double_unlock_hb(hb1, hb2);
1829 wake_up_q(&wake_q); 1832 wake_up_q(&wake_q);
1830 hb_waiters_dec(hb2); 1833 hb_waiters_dec(hb2);
@@ -1973,7 +1976,7 @@ static void unqueue_me_pi(struct futex_q *q)
1973 __unqueue_futex(q); 1976 __unqueue_futex(q);
1974 1977
1975 BUG_ON(!q->pi_state); 1978 BUG_ON(!q->pi_state);
1976 free_pi_state(q->pi_state); 1979 put_pi_state(q->pi_state);
1977 q->pi_state = NULL; 1980 q->pi_state = NULL;
1978 1981
1979 spin_unlock(q->lock_ptr); 1982 spin_unlock(q->lock_ptr);
@@ -2759,7 +2762,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
2759 * Drop the reference to the pi state which 2762 * Drop the reference to the pi state which
2760 * the requeue_pi() code acquired for us. 2763 * the requeue_pi() code acquired for us.
2761 */ 2764 */
2762 free_pi_state(q.pi_state); 2765 put_pi_state(q.pi_state);
2763 spin_unlock(q.lock_ptr); 2766 spin_unlock(q.lock_ptr);
2764 } 2767 }
2765 } else { 2768 } else {