diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-23 15:11:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-23 15:11:17 -0400 |
commit | 6720a305df74ca30bcc10fc316881641b6ff0c80 (patch) | |
tree | 3e7f20a6756579c4a155dca37ebdf088b4305ecf | |
parent | f9020d17416ae62f1b1c6459d61e65abb4af79b5 (diff) |
locking: avoid passing around 'thread_info' in mutex debugging code
None of the code actually wants a thread_info, it all wants a
task_struct, and it's just converting back and forth between the two
("ti->task" to get the task_struct from the thread_info, and
"task_thread_info(task)" to go the other way).
No semantic change.
Acked-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/locking/mutex-debug.c | 12 | ||||
-rw-r--r-- | kernel/locking/mutex-debug.h | 4 | ||||
-rw-r--r-- | kernel/locking/mutex.c | 6 | ||||
-rw-r--r-- | kernel/locking/mutex.h | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c index 3ef3736002d8..9c951fade415 100644 --- a/kernel/locking/mutex-debug.c +++ b/kernel/locking/mutex-debug.c | |||
@@ -49,21 +49,21 @@ void debug_mutex_free_waiter(struct mutex_waiter *waiter) | |||
49 | } | 49 | } |
50 | 50 | ||
51 | void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter, | 51 | void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
52 | struct thread_info *ti) | 52 | struct task_struct *task) |
53 | { | 53 | { |
54 | SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock)); | 54 | SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock)); |
55 | 55 | ||
56 | /* Mark the current thread as blocked on the lock: */ | 56 | /* Mark the current thread as blocked on the lock: */ |
57 | ti->task->blocked_on = waiter; | 57 | task->blocked_on = waiter; |
58 | } | 58 | } |
59 | 59 | ||
60 | void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, | 60 | void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
61 | struct thread_info *ti) | 61 | struct task_struct *task) |
62 | { | 62 | { |
63 | DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list)); | 63 | DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list)); |
64 | DEBUG_LOCKS_WARN_ON(waiter->task != ti->task); | 64 | DEBUG_LOCKS_WARN_ON(waiter->task != task); |
65 | DEBUG_LOCKS_WARN_ON(ti->task->blocked_on != waiter); | 65 | DEBUG_LOCKS_WARN_ON(task->blocked_on != waiter); |
66 | ti->task->blocked_on = NULL; | 66 | task->blocked_on = NULL; |
67 | 67 | ||
68 | list_del_init(&waiter->list); | 68 | list_del_init(&waiter->list); |
69 | waiter->task = NULL; | 69 | waiter->task = NULL; |
diff --git a/kernel/locking/mutex-debug.h b/kernel/locking/mutex-debug.h index 0799fd3e4cfa..d06ae3bb46c5 100644 --- a/kernel/locking/mutex-debug.h +++ b/kernel/locking/mutex-debug.h | |||
@@ -20,9 +20,9 @@ extern void debug_mutex_wake_waiter(struct mutex *lock, | |||
20 | extern void debug_mutex_free_waiter(struct mutex_waiter *waiter); | 20 | extern void debug_mutex_free_waiter(struct mutex_waiter *waiter); |
21 | extern void debug_mutex_add_waiter(struct mutex *lock, | 21 | extern void debug_mutex_add_waiter(struct mutex *lock, |
22 | struct mutex_waiter *waiter, | 22 | struct mutex_waiter *waiter, |
23 | struct thread_info *ti); | 23 | struct task_struct *task); |
24 | extern void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, | 24 | extern void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, |
25 | struct thread_info *ti); | 25 | struct task_struct *task); |
26 | extern void debug_mutex_unlock(struct mutex *lock); | 26 | extern void debug_mutex_unlock(struct mutex *lock); |
27 | extern void debug_mutex_init(struct mutex *lock, const char *name, | 27 | extern void debug_mutex_init(struct mutex *lock, const char *name, |
28 | struct lock_class_key *key); | 28 | struct lock_class_key *key); |
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 79d2d765a75f..a70b90db3909 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c | |||
@@ -537,7 +537,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, | |||
537 | goto skip_wait; | 537 | goto skip_wait; |
538 | 538 | ||
539 | debug_mutex_lock_common(lock, &waiter); | 539 | debug_mutex_lock_common(lock, &waiter); |
540 | debug_mutex_add_waiter(lock, &waiter, task_thread_info(task)); | 540 | debug_mutex_add_waiter(lock, &waiter, task); |
541 | 541 | ||
542 | /* add waiting tasks to the end of the waitqueue (FIFO): */ | 542 | /* add waiting tasks to the end of the waitqueue (FIFO): */ |
543 | list_add_tail(&waiter.list, &lock->wait_list); | 543 | list_add_tail(&waiter.list, &lock->wait_list); |
@@ -584,7 +584,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, | |||
584 | } | 584 | } |
585 | __set_task_state(task, TASK_RUNNING); | 585 | __set_task_state(task, TASK_RUNNING); |
586 | 586 | ||
587 | mutex_remove_waiter(lock, &waiter, current_thread_info()); | 587 | mutex_remove_waiter(lock, &waiter, task); |
588 | /* set it to 0 if there are no waiters left: */ | 588 | /* set it to 0 if there are no waiters left: */ |
589 | if (likely(list_empty(&lock->wait_list))) | 589 | if (likely(list_empty(&lock->wait_list))) |
590 | atomic_set(&lock->count, 0); | 590 | atomic_set(&lock->count, 0); |
@@ -605,7 +605,7 @@ skip_wait: | |||
605 | return 0; | 605 | return 0; |
606 | 606 | ||
607 | err: | 607 | err: |
608 | mutex_remove_waiter(lock, &waiter, task_thread_info(task)); | 608 | mutex_remove_waiter(lock, &waiter, task); |
609 | spin_unlock_mutex(&lock->wait_lock, flags); | 609 | spin_unlock_mutex(&lock->wait_lock, flags); |
610 | debug_mutex_free_waiter(&waiter); | 610 | debug_mutex_free_waiter(&waiter); |
611 | mutex_release(&lock->dep_map, 1, ip); | 611 | mutex_release(&lock->dep_map, 1, ip); |
diff --git a/kernel/locking/mutex.h b/kernel/locking/mutex.h index 5cda397607f2..a68bae5e852a 100644 --- a/kernel/locking/mutex.h +++ b/kernel/locking/mutex.h | |||
@@ -13,7 +13,7 @@ | |||
13 | do { spin_lock(lock); (void)(flags); } while (0) | 13 | do { spin_lock(lock); (void)(flags); } while (0) |
14 | #define spin_unlock_mutex(lock, flags) \ | 14 | #define spin_unlock_mutex(lock, flags) \ |
15 | do { spin_unlock(lock); (void)(flags); } while (0) | 15 | do { spin_unlock(lock); (void)(flags); } while (0) |
16 | #define mutex_remove_waiter(lock, waiter, ti) \ | 16 | #define mutex_remove_waiter(lock, waiter, task) \ |
17 | __list_del((waiter)->list.prev, (waiter)->list.next) | 17 | __list_del((waiter)->list.prev, (waiter)->list.next) |
18 | 18 | ||
19 | #ifdef CONFIG_MUTEX_SPIN_ON_OWNER | 19 | #ifdef CONFIG_MUTEX_SPIN_ON_OWNER |