[PATCH 03/17] futex: Remove rt_mutex_deadlock_account_*()

2018-11-09 Thread Henrik Austad
From: Peter Zijlstra 

commit fffa954fb528963c2fb7b0c0084eb77e2be7ab52 upstream

These are unused and clutter up the code.

Signed-off-by: Peter Zijlstra (Intel) 
Cc: juri.le...@arm.com
Cc: bige...@linutronix.de
Cc: xlp...@redhat.com
Cc: rost...@goodmis.org
Cc: mathieu.desnoy...@efficios.com
Cc: jdesfos...@efficios.com
Cc: dvh...@infradead.org
Cc: bris...@redhat.com
Link: http://lkml.kernel.org/r/20170322104151.652692...@infradead.org
Signed-off-by: Thomas Gleixner 

Conflicts:
kernel/locking/rtmutex.c (WAKE_Q)
Tested-by: Henrik Austad 
---
 kernel/locking/rtmutex-debug.c |  9 
 kernel/locking/rtmutex-debug.h |  3 ---
 kernel/locking/rtmutex.c   | 47 --
 kernel/locking/rtmutex.h   |  2 --
 4 files changed, 18 insertions(+), 43 deletions(-)

diff --git a/kernel/locking/rtmutex-debug.c b/kernel/locking/rtmutex-debug.c
index 62b6cee..0613c4b 100644
--- a/kernel/locking/rtmutex-debug.c
+++ b/kernel/locking/rtmutex-debug.c
@@ -173,12 +173,3 @@ void debug_rt_mutex_init(struct rt_mutex *lock, const char 
*name)
lock->name = name;
 }
 
-void
-rt_mutex_deadlock_account_lock(struct rt_mutex *lock, struct task_struct *task)
-{
-}
-
-void rt_mutex_deadlock_account_unlock(struct task_struct *task)
-{
-}
-
diff --git a/kernel/locking/rtmutex-debug.h b/kernel/locking/rtmutex-debug.h
index d0519c3..b585af9 100644
--- a/kernel/locking/rtmutex-debug.h
+++ b/kernel/locking/rtmutex-debug.h
@@ -9,9 +9,6 @@
  * This file contains macros used solely by rtmutex.c. Debug version.
  */
 
-extern void
-rt_mutex_deadlock_account_lock(struct rt_mutex *lock, struct task_struct 
*task);
-extern void rt_mutex_deadlock_account_unlock(struct task_struct *task);
 extern void debug_rt_mutex_init_waiter(struct rt_mutex_waiter *waiter);
 extern void debug_rt_mutex_free_waiter(struct rt_mutex_waiter *waiter);
 extern void debug_rt_mutex_init(struct rt_mutex *lock, const char *name);
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index b066724d..6cf9dab7 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -937,8 +937,6 @@ takeit:
 */
rt_mutex_set_owner(lock, task);
 
-   rt_mutex_deadlock_account_lock(lock, task);
-
return 1;
 }
 
@@ -1331,8 +1329,6 @@ static bool __sched rt_mutex_slowunlock(struct rt_mutex 
*lock,
 
debug_rt_mutex_unlock(lock);
 
-   rt_mutex_deadlock_account_unlock(current);
-
/*
 * We must be careful here if the fast path is enabled. If we
 * have no waiters queued we cannot set owner to NULL here
@@ -1398,11 +1394,10 @@ rt_mutex_fastlock(struct rt_mutex *lock, int state,
struct hrtimer_sleeper *timeout,
enum rtmutex_chainwalk chwalk))
 {
-   if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current))) {
-   rt_mutex_deadlock_account_lock(lock, current);
+   if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current)))
return 0;
-   } else
-   return slowfn(lock, state, NULL, RT_MUTEX_MIN_CHAINWALK);
+
+   return slowfn(lock, state, NULL, RT_MUTEX_MIN_CHAINWALK);
 }
 
 static inline int
@@ -1414,21 +1409,19 @@ rt_mutex_timed_fastlock(struct rt_mutex *lock, int 
state,
  enum rtmutex_chainwalk chwalk))
 {
if (chwalk == RT_MUTEX_MIN_CHAINWALK &&
-   likely(rt_mutex_cmpxchg_acquire(lock, NULL, current))) {
-   rt_mutex_deadlock_account_lock(lock, current);
+   likely(rt_mutex_cmpxchg_acquire(lock, NULL, current)))
return 0;
-   } else
-   return slowfn(lock, state, timeout, chwalk);
+
+   return slowfn(lock, state, timeout, chwalk);
 }
 
 static inline int
 rt_mutex_fasttrylock(struct rt_mutex *lock,
 int (*slowfn)(struct rt_mutex *lock))
 {
-   if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current))) {
-   rt_mutex_deadlock_account_lock(lock, current);
+   if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current)))
return 1;
-   }
+
return slowfn(lock);
 }
 
@@ -1438,19 +1431,18 @@ rt_mutex_fastunlock(struct rt_mutex *lock,
   struct wake_q_head *wqh))
 {
WAKE_Q(wake_q);
+   bool deboost;
 
-   if (likely(rt_mutex_cmpxchg_release(lock, current, NULL))) {
-   rt_mutex_deadlock_account_unlock(current);
+   if (likely(rt_mutex_cmpxchg_release(lock, current, NULL)))
+   return;
 
-   } else {
-   bool deboost = slowfn(lock, _q);
+   deboost = slowfn(lock, _q);
 
-   wake_up_q(_q);
+   wake_up_q(_q);
 
-   /* Undo pi boosting if necessary: */
-   if (deboost)
-   rt_mutex_adjust_prio(current);
-   }
+   /* Undo pi boosting if necessary: */
+   if (deboost)
+   rt_mutex_adjust_prio(current);
 }
 
 

[PATCH 03/17] futex: Remove rt_mutex_deadlock_account_*()

2018-11-09 Thread Henrik Austad
From: Peter Zijlstra 

commit fffa954fb528963c2fb7b0c0084eb77e2be7ab52 upstream

These are unused and clutter up the code.

Signed-off-by: Peter Zijlstra (Intel) 
Cc: juri.le...@arm.com
Cc: bige...@linutronix.de
Cc: xlp...@redhat.com
Cc: rost...@goodmis.org
Cc: mathieu.desnoy...@efficios.com
Cc: jdesfos...@efficios.com
Cc: dvh...@infradead.org
Cc: bris...@redhat.com
Link: http://lkml.kernel.org/r/20170322104151.652692...@infradead.org
Signed-off-by: Thomas Gleixner 

Conflicts:
kernel/locking/rtmutex.c (WAKE_Q)
Tested-by: Henrik Austad 
---
 kernel/locking/rtmutex-debug.c |  9 
 kernel/locking/rtmutex-debug.h |  3 ---
 kernel/locking/rtmutex.c   | 47 --
 kernel/locking/rtmutex.h   |  2 --
 4 files changed, 18 insertions(+), 43 deletions(-)

diff --git a/kernel/locking/rtmutex-debug.c b/kernel/locking/rtmutex-debug.c
index 62b6cee..0613c4b 100644
--- a/kernel/locking/rtmutex-debug.c
+++ b/kernel/locking/rtmutex-debug.c
@@ -173,12 +173,3 @@ void debug_rt_mutex_init(struct rt_mutex *lock, const char 
*name)
lock->name = name;
 }
 
-void
-rt_mutex_deadlock_account_lock(struct rt_mutex *lock, struct task_struct *task)
-{
-}
-
-void rt_mutex_deadlock_account_unlock(struct task_struct *task)
-{
-}
-
diff --git a/kernel/locking/rtmutex-debug.h b/kernel/locking/rtmutex-debug.h
index d0519c3..b585af9 100644
--- a/kernel/locking/rtmutex-debug.h
+++ b/kernel/locking/rtmutex-debug.h
@@ -9,9 +9,6 @@
  * This file contains macros used solely by rtmutex.c. Debug version.
  */
 
-extern void
-rt_mutex_deadlock_account_lock(struct rt_mutex *lock, struct task_struct 
*task);
-extern void rt_mutex_deadlock_account_unlock(struct task_struct *task);
 extern void debug_rt_mutex_init_waiter(struct rt_mutex_waiter *waiter);
 extern void debug_rt_mutex_free_waiter(struct rt_mutex_waiter *waiter);
 extern void debug_rt_mutex_init(struct rt_mutex *lock, const char *name);
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index b066724d..6cf9dab7 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -937,8 +937,6 @@ takeit:
 */
rt_mutex_set_owner(lock, task);
 
-   rt_mutex_deadlock_account_lock(lock, task);
-
return 1;
 }
 
@@ -1331,8 +1329,6 @@ static bool __sched rt_mutex_slowunlock(struct rt_mutex 
*lock,
 
debug_rt_mutex_unlock(lock);
 
-   rt_mutex_deadlock_account_unlock(current);
-
/*
 * We must be careful here if the fast path is enabled. If we
 * have no waiters queued we cannot set owner to NULL here
@@ -1398,11 +1394,10 @@ rt_mutex_fastlock(struct rt_mutex *lock, int state,
struct hrtimer_sleeper *timeout,
enum rtmutex_chainwalk chwalk))
 {
-   if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current))) {
-   rt_mutex_deadlock_account_lock(lock, current);
+   if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current)))
return 0;
-   } else
-   return slowfn(lock, state, NULL, RT_MUTEX_MIN_CHAINWALK);
+
+   return slowfn(lock, state, NULL, RT_MUTEX_MIN_CHAINWALK);
 }
 
 static inline int
@@ -1414,21 +1409,19 @@ rt_mutex_timed_fastlock(struct rt_mutex *lock, int 
state,
  enum rtmutex_chainwalk chwalk))
 {
if (chwalk == RT_MUTEX_MIN_CHAINWALK &&
-   likely(rt_mutex_cmpxchg_acquire(lock, NULL, current))) {
-   rt_mutex_deadlock_account_lock(lock, current);
+   likely(rt_mutex_cmpxchg_acquire(lock, NULL, current)))
return 0;
-   } else
-   return slowfn(lock, state, timeout, chwalk);
+
+   return slowfn(lock, state, timeout, chwalk);
 }
 
 static inline int
 rt_mutex_fasttrylock(struct rt_mutex *lock,
 int (*slowfn)(struct rt_mutex *lock))
 {
-   if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current))) {
-   rt_mutex_deadlock_account_lock(lock, current);
+   if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current)))
return 1;
-   }
+
return slowfn(lock);
 }
 
@@ -1438,19 +1431,18 @@ rt_mutex_fastunlock(struct rt_mutex *lock,
   struct wake_q_head *wqh))
 {
WAKE_Q(wake_q);
+   bool deboost;
 
-   if (likely(rt_mutex_cmpxchg_release(lock, current, NULL))) {
-   rt_mutex_deadlock_account_unlock(current);
+   if (likely(rt_mutex_cmpxchg_release(lock, current, NULL)))
+   return;
 
-   } else {
-   bool deboost = slowfn(lock, _q);
+   deboost = slowfn(lock, _q);
 
-   wake_up_q(_q);
+   wake_up_q(_q);
 
-   /* Undo pi boosting if necessary: */
-   if (deboost)
-   rt_mutex_adjust_prio(current);
-   }
+   /* Undo pi boosting if necessary: */
+   if (deboost)
+   rt_mutex_adjust_prio(current);
 }