perf: Fix race in removing an event
[platform/adaptation/renesas_rcar/renesas_kernel.git] / kernel / locking / rtmutex_common.h
index 53a66c8..7431a9c 100644 (file)
@@ -40,13 +40,13 @@ extern void schedule_rt_mutex_test(struct rt_mutex *lock);
  * This is the control structure for tasks blocked on a rt_mutex,
  * which is allocated on the kernel stack on of the blocked task.
  *
- * @list_entry:                pi node to enqueue into the mutex waiters list
- * @pi_list_entry:     pi node to enqueue into the mutex owner waiters list
+ * @tree_entry:                pi node to enqueue into the mutex waiters tree
+ * @pi_tree_entry:     pi node to enqueue into the mutex owner waiters tree
  * @task:              task reference to the blocked task
  */
 struct rt_mutex_waiter {
-       struct plist_node       list_entry;
-       struct plist_node       pi_list_entry;
+       struct rb_node          tree_entry;
+       struct rb_node          pi_tree_entry;
        struct task_struct      *task;
        struct rt_mutex         *lock;
 #ifdef CONFIG_DEBUG_RT_MUTEXES
@@ -54,14 +54,15 @@ struct rt_mutex_waiter {
        struct pid              *deadlock_task_pid;
        struct rt_mutex         *deadlock_lock;
 #endif
+       int prio;
 };
 
 /*
- * Various helpers to access the waiters-plist:
+ * Various helpers to access the waiters-tree:
  */
 static inline int rt_mutex_has_waiters(struct rt_mutex *lock)
 {
-       return !plist_head_empty(&lock->wait_list);
+       return !RB_EMPTY_ROOT(&lock->waiters);
 }
 
 static inline struct rt_mutex_waiter *
@@ -69,8 +70,8 @@ rt_mutex_top_waiter(struct rt_mutex *lock)
 {
        struct rt_mutex_waiter *w;
 
-       w = plist_first_entry(&lock->wait_list, struct rt_mutex_waiter,
-                              list_entry);
+       w = rb_entry(lock->waiters_leftmost, struct rt_mutex_waiter,
+                    tree_entry);
        BUG_ON(w->lock != lock);
 
        return w;
@@ -78,14 +79,14 @@ rt_mutex_top_waiter(struct rt_mutex *lock)
 
 static inline int task_has_pi_waiters(struct task_struct *p)
 {
-       return !plist_head_empty(&p->pi_waiters);
+       return !RB_EMPTY_ROOT(&p->pi_waiters);
 }
 
 static inline struct rt_mutex_waiter *
 task_top_pi_waiter(struct task_struct *p)
 {
-       return plist_first_entry(&p->pi_waiters, struct rt_mutex_waiter,
-                                 pi_list_entry);
+       return rb_entry(p->pi_waiters_leftmost, struct rt_mutex_waiter,
+                       pi_tree_entry);
 }
 
 /*