Commit 48d13e483c5b450be451f78cc9cb43c0bdd6b7bb
Committed by
Linus Torvalds
1 parent
8dc86af006
Exists in
master
and in
20 other branches
Don't operate with pid_t in rtmutex tester
The proper behavior to store task's pid and get this task later is to get the struct pid pointer and get the task with the pid_task() call. Make it for rt_mutex_waiter->deadlock_task_pid field. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 10 additions and 4 deletions Side-by-side Diff
kernel/rtmutex-debug.c
... | ... | @@ -130,7 +130,7 @@ |
130 | 130 | |
131 | 131 | task = rt_mutex_owner(act_waiter->lock); |
132 | 132 | if (task && task != current) { |
133 | - act_waiter->deadlock_task_pid = task->pid; | |
133 | + act_waiter->deadlock_task_pid = get_pid(task_pid(task)); | |
134 | 134 | act_waiter->deadlock_lock = lock; |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
... | ... | @@ -142,9 +142,12 @@ |
142 | 142 | if (!waiter->deadlock_lock || !rt_trace_on) |
143 | 143 | return; |
144 | 144 | |
145 | - task = find_task_by_pid(waiter->deadlock_task_pid); | |
146 | - if (!task) | |
145 | + rcu_read_lock(); | |
146 | + task = pid_task(waiter->deadlock_task_pid, PIDTYPE_PID); | |
147 | + if (!task) { | |
148 | + rcu_read_unlock(); | |
147 | 149 | return; |
150 | + } | |
148 | 151 | |
149 | 152 | TRACE_OFF_NOLOCK(); |
150 | 153 | |
... | ... | @@ -173,6 +176,7 @@ |
173 | 176 | current->comm, task_pid_nr(current)); |
174 | 177 | dump_stack(); |
175 | 178 | debug_show_all_locks(); |
179 | + rcu_read_unlock(); | |
176 | 180 | |
177 | 181 | printk("[ turning off deadlock detection." |
178 | 182 | "Please report this trace. ]\n\n"); |
179 | 183 | |
... | ... | @@ -203,10 +207,12 @@ |
203 | 207 | memset(waiter, 0x11, sizeof(*waiter)); |
204 | 208 | plist_node_init(&waiter->list_entry, MAX_PRIO); |
205 | 209 | plist_node_init(&waiter->pi_list_entry, MAX_PRIO); |
210 | + waiter->deadlock_task_pid = NULL; | |
206 | 211 | } |
207 | 212 | |
208 | 213 | void debug_rt_mutex_free_waiter(struct rt_mutex_waiter *waiter) |
209 | 214 | { |
215 | + put_pid(waiter->deadlock_task_pid); | |
210 | 216 | TRACE_WARN_ON(!plist_node_empty(&waiter->list_entry)); |
211 | 217 | TRACE_WARN_ON(!plist_node_empty(&waiter->pi_list_entry)); |
212 | 218 | TRACE_WARN_ON(waiter->task); |