Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lockdep: remove task argument from debug_check_no_locks_held

The only existing caller to debug_check_no_locks_held calls it
with 'current' as the task, and the freezer needs to call
debug_check_no_locks_held but doesn't already have a current
task pointer, so remove the argument. It is already assuming
that the current task is relevant by dumping the current stack
trace as part of the warning.

This was originally part of 6aa9707099c (lockdep: check that
no locks held at freeze time) which was reverted in
dbf520a9d7d4.

Original-author: Mandeep Singh Baines <msb@chromium.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Colin Cross and committed by
Rafael J. Wysocki
1b1d2fb4 5853cc2a

+11 -12
+2 -2
include/linux/debug_locks.h
··· 51 51 extern void debug_show_all_locks(void); 52 52 extern void debug_show_held_locks(struct task_struct *task); 53 53 extern void debug_check_no_locks_freed(const void *from, unsigned long len); 54 - extern void debug_check_no_locks_held(struct task_struct *task); 54 + extern void debug_check_no_locks_held(void); 55 55 #else 56 56 static inline void debug_show_all_locks(void) 57 57 { ··· 67 67 } 68 68 69 69 static inline void 70 - debug_check_no_locks_held(struct task_struct *task) 70 + debug_check_no_locks_held(void) 71 71 { 72 72 } 73 73 #endif
+1 -1
kernel/exit.c
··· 835 835 /* 836 836 * Make sure we are holding no locks: 837 837 */ 838 - debug_check_no_locks_held(tsk); 838 + debug_check_no_locks_held(); 839 839 /* 840 840 * We can do this unlocked here. The futex code uses this flag 841 841 * just to verify whether the pi state cleanup has been done
+8 -9
kernel/lockdep.c
··· 4090 4090 } 4091 4091 EXPORT_SYMBOL_GPL(debug_check_no_locks_freed); 4092 4092 4093 - static void print_held_locks_bug(struct task_struct *curr) 4093 + static void print_held_locks_bug(void) 4094 4094 { 4095 4095 if (!debug_locks_off()) 4096 4096 return; ··· 4099 4099 4100 4100 printk("\n"); 4101 4101 printk("=====================================\n"); 4102 - printk("[ BUG: lock held at task exit time! ]\n"); 4102 + printk("[ BUG: %s/%d still has locks held! ]\n", 4103 + current->comm, task_pid_nr(current)); 4103 4104 print_kernel_ident(); 4104 4105 printk("-------------------------------------\n"); 4105 - printk("%s/%d is exiting with locks still held!\n", 4106 - curr->comm, task_pid_nr(curr)); 4107 - lockdep_print_held_locks(curr); 4108 - 4106 + lockdep_print_held_locks(current); 4109 4107 printk("\nstack backtrace:\n"); 4110 4108 dump_stack(); 4111 4109 } 4112 4110 4113 - void debug_check_no_locks_held(struct task_struct *task) 4111 + void debug_check_no_locks_held(void) 4114 4112 { 4115 - if (unlikely(task->lockdep_depth > 0)) 4116 - print_held_locks_bug(task); 4113 + if (unlikely(current->lockdep_depth > 0)) 4114 + print_held_locks_bug(); 4117 4115 } 4116 + EXPORT_SYMBOL_GPL(debug_check_no_locks_held); 4118 4117 4119 4118 void debug_show_all_locks(void) 4120 4119 {