@@ -1228,16 +1228,15 @@ rt_mutex_slowunlock(struct rt_mutex *lock)
12281228 */
12291229static inline int
12301230rt_mutex_fastlock (struct rt_mutex * lock , int state ,
1231- int detect_deadlock ,
12321231 int (* slowfn )(struct rt_mutex * lock , int state ,
12331232 struct hrtimer_sleeper * timeout ,
12341233 int detect_deadlock ))
12351234{
1236- if (! detect_deadlock && likely (rt_mutex_cmpxchg (lock , NULL , current ))) {
1235+ if (likely (rt_mutex_cmpxchg (lock , NULL , current ))) {
12371236 rt_mutex_deadlock_account_lock (lock , current );
12381237 return 0 ;
12391238 } else
1240- return slowfn (lock , state , NULL , detect_deadlock );
1239+ return slowfn (lock , state , NULL , 0 );
12411240}
12421241
12431242static inline int
@@ -1284,54 +1283,59 @@ void __sched rt_mutex_lock(struct rt_mutex *lock)
12841283{
12851284 might_sleep ();
12861285
1287- rt_mutex_fastlock (lock , TASK_UNINTERRUPTIBLE , 0 , rt_mutex_slowlock );
1286+ rt_mutex_fastlock (lock , TASK_UNINTERRUPTIBLE , rt_mutex_slowlock );
12881287}
12891288EXPORT_SYMBOL_GPL (rt_mutex_lock );
12901289
12911290/**
12921291 * rt_mutex_lock_interruptible - lock a rt_mutex interruptible
12931292 *
1294- * @lock: the rt_mutex to be locked
1295- * @detect_deadlock: deadlock detection on/off
1293+ * @lock: the rt_mutex to be locked
12961294 *
12971295 * Returns:
1298- * 0 on success
1299- * -EINTR when interrupted by a signal
1300- * -EDEADLK when the lock would deadlock (when deadlock detection is on)
1296+ * 0 on success
1297+ * -EINTR when interrupted by a signal
13011298 */
1302- int __sched rt_mutex_lock_interruptible (struct rt_mutex * lock ,
1303- int detect_deadlock )
1299+ int __sched rt_mutex_lock_interruptible (struct rt_mutex * lock )
13041300{
13051301 might_sleep ();
13061302
1307- return rt_mutex_fastlock (lock , TASK_INTERRUPTIBLE ,
1308- detect_deadlock , rt_mutex_slowlock );
1303+ return rt_mutex_fastlock (lock , TASK_INTERRUPTIBLE , rt_mutex_slowlock );
13091304}
13101305EXPORT_SYMBOL_GPL (rt_mutex_lock_interruptible );
13111306
1307+ /*
1308+ * Futex variant with full deadlock detection.
1309+ */
1310+ int rt_mutex_timed_futex_lock (struct rt_mutex * lock ,
1311+ struct hrtimer_sleeper * timeout )
1312+ {
1313+ might_sleep ();
1314+
1315+ return rt_mutex_timed_fastlock (lock , TASK_INTERRUPTIBLE , timeout , 1 ,
1316+ rt_mutex_slowlock );
1317+ }
1318+
13121319/**
13131320 * rt_mutex_timed_lock - lock a rt_mutex interruptible
13141321 * the timeout structure is provided
13151322 * by the caller
13161323 *
1317- * @lock: the rt_mutex to be locked
1324+ * @lock: the rt_mutex to be locked
13181325 * @timeout: timeout structure or NULL (no timeout)
1319- * @detect_deadlock: deadlock detection on/off
13201326 *
13211327 * Returns:
1322- * 0 on success
1323- * -EINTR when interrupted by a signal
1328+ * 0 on success
1329+ * -EINTR when interrupted by a signal
13241330 * -ETIMEDOUT when the timeout expired
1325- * -EDEADLK when the lock would deadlock (when deadlock detection is on)
13261331 */
13271332int
1328- rt_mutex_timed_lock (struct rt_mutex * lock , struct hrtimer_sleeper * timeout ,
1329- int detect_deadlock )
1333+ rt_mutex_timed_lock (struct rt_mutex * lock , struct hrtimer_sleeper * timeout )
13301334{
13311335 might_sleep ();
13321336
1333- return rt_mutex_timed_fastlock (lock , TASK_INTERRUPTIBLE , timeout ,
1334- detect_deadlock , rt_mutex_slowlock );
1337+ return rt_mutex_timed_fastlock (lock , TASK_INTERRUPTIBLE , timeout , 0 ,
1338+ rt_mutex_slowlock );
13351339}
13361340EXPORT_SYMBOL_GPL (rt_mutex_timed_lock );
13371341
@@ -1437,7 +1441,6 @@ void rt_mutex_proxy_unlock(struct rt_mutex *lock,
14371441 * @lock: the rt_mutex to take
14381442 * @waiter: the pre-initialized rt_mutex_waiter
14391443 * @task: the task to prepare
1440- * @detect_deadlock: perform deadlock detection (1) or not (0)
14411444 *
14421445 * Returns:
14431446 * 0 - task blocked on lock
@@ -1448,7 +1451,7 @@ void rt_mutex_proxy_unlock(struct rt_mutex *lock,
14481451 */
14491452int rt_mutex_start_proxy_lock (struct rt_mutex * lock ,
14501453 struct rt_mutex_waiter * waiter ,
1451- struct task_struct * task , int detect_deadlock )
1454+ struct task_struct * task )
14521455{
14531456 int ret ;
14541457
@@ -1506,22 +1509,20 @@ struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock)
15061509 * rt_mutex_finish_proxy_lock() - Complete lock acquisition
15071510 * @lock: the rt_mutex we were woken on
15081511 * @to: the timeout, null if none. hrtimer should already have
1509- * been started.
1512+ * been started.
15101513 * @waiter: the pre-initialized rt_mutex_waiter
1511- * @detect_deadlock: perform deadlock detection (1) or not (0)
15121514 *
15131515 * Complete the lock acquisition started our behalf by another thread.
15141516 *
15151517 * Returns:
15161518 * 0 - success
1517- * <0 - error, one of -EINTR, -ETIMEDOUT, or -EDEADLK
1519+ * <0 - error, one of -EINTR, -ETIMEDOUT
15181520 *
15191521 * Special API call for PI-futex requeue support
15201522 */
15211523int rt_mutex_finish_proxy_lock (struct rt_mutex * lock ,
15221524 struct hrtimer_sleeper * to ,
1523- struct rt_mutex_waiter * waiter ,
1524- int detect_deadlock )
1525+ struct rt_mutex_waiter * waiter )
15251526{
15261527 int ret ;
15271528
0 commit comments