@@ -944,7 +944,6 @@ static void exit_pi_state_list(struct task_struct *curr)
944
944
{
945
945
struct list_head * next , * head = & curr -> pi_state_list ;
946
946
struct futex_pi_state * pi_state ;
947
- struct futex_hash_bucket * hb ;
948
947
union futex_key key = FUTEX_KEY_INIT ;
949
948
950
949
/*
@@ -957,50 +956,54 @@ static void exit_pi_state_list(struct task_struct *curr)
957
956
next = head -> next ;
958
957
pi_state = list_entry (next , struct futex_pi_state , list );
959
958
key = pi_state -> key ;
960
- hb = futex_hash (& key );
961
-
962
- /*
963
- * We can race against put_pi_state() removing itself from the
964
- * list (a waiter going away). put_pi_state() will first
965
- * decrement the reference count and then modify the list, so
966
- * its possible to see the list entry but fail this reference
967
- * acquire.
968
- *
969
- * In that case; drop the locks to let put_pi_state() make
970
- * progress and retry the loop.
971
- */
972
- if (!refcount_inc_not_zero (& pi_state -> refcount )) {
959
+ if (1 ) {
960
+ struct futex_hash_bucket * hb ;
961
+
962
+ hb = futex_hash (& key );
963
+
964
+ /*
965
+ * We can race against put_pi_state() removing itself from the
966
+ * list (a waiter going away). put_pi_state() will first
967
+ * decrement the reference count and then modify the list, so
968
+ * its possible to see the list entry but fail this reference
969
+ * acquire.
970
+ *
971
+ * In that case; drop the locks to let put_pi_state() make
972
+ * progress and retry the loop.
973
+ */
974
+ if (!refcount_inc_not_zero (& pi_state -> refcount )) {
975
+ raw_spin_unlock_irq (& curr -> pi_lock );
976
+ cpu_relax ();
977
+ raw_spin_lock_irq (& curr -> pi_lock );
978
+ continue ;
979
+ }
973
980
raw_spin_unlock_irq (& curr -> pi_lock );
974
- cpu_relax ();
975
- raw_spin_lock_irq (& curr -> pi_lock );
976
- continue ;
977
- }
978
- raw_spin_unlock_irq (& curr -> pi_lock );
979
981
980
- spin_lock (& hb -> lock );
981
- raw_spin_lock_irq (& pi_state -> pi_mutex .wait_lock );
982
- raw_spin_lock (& curr -> pi_lock );
983
- /*
984
- * We dropped the pi-lock, so re-check whether this
985
- * task still owns the PI-state:
986
- */
987
- if (head -> next != next ) {
988
- /* retain curr->pi_lock for the loop invariant */
989
- raw_spin_unlock (& pi_state -> pi_mutex .wait_lock );
982
+ spin_lock (& hb -> lock );
983
+ raw_spin_lock_irq (& pi_state -> pi_mutex .wait_lock );
984
+ raw_spin_lock (& curr -> pi_lock );
985
+ /*
986
+ * We dropped the pi-lock, so re-check whether this
987
+ * task still owns the PI-state:
988
+ */
989
+ if (head -> next != next ) {
990
+ /* retain curr->pi_lock for the loop invariant */
991
+ raw_spin_unlock (& pi_state -> pi_mutex .wait_lock );
992
+ spin_unlock (& hb -> lock );
993
+ put_pi_state (pi_state );
994
+ continue ;
995
+ }
996
+
997
+ WARN_ON (pi_state -> owner != curr );
998
+ WARN_ON (list_empty (& pi_state -> list ));
999
+ list_del_init (& pi_state -> list );
1000
+ pi_state -> owner = NULL ;
1001
+
1002
+ raw_spin_unlock (& curr -> pi_lock );
1003
+ raw_spin_unlock_irq (& pi_state -> pi_mutex .wait_lock );
990
1004
spin_unlock (& hb -> lock );
991
- put_pi_state (pi_state );
992
- continue ;
993
1005
}
994
1006
995
- WARN_ON (pi_state -> owner != curr );
996
- WARN_ON (list_empty (& pi_state -> list ));
997
- list_del_init (& pi_state -> list );
998
- pi_state -> owner = NULL ;
999
-
1000
- raw_spin_unlock (& curr -> pi_lock );
1001
- raw_spin_unlock_irq (& pi_state -> pi_mutex .wait_lock );
1002
- spin_unlock (& hb -> lock );
1003
-
1004
1007
rt_mutex_futex_unlock (& pi_state -> pi_mutex );
1005
1008
put_pi_state (pi_state );
1006
1009
0 commit comments