Skip to content

Commit 1b1d2fb

Browse files
colincrossrafaeljw
authored andcommitted
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 6aa9707 (lockdep: check that no locks held at freeze time) which was reverted in dbf520a. Original-author: Mandeep Singh Baines <[email protected]> Acked-by: Pavel Machek <[email protected]> Acked-by: Tejun Heo <[email protected]> Signed-off-by: Colin Cross <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 5853cc2 commit 1b1d2fb

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

include/linux/debug_locks.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct task_struct;
5151
extern void debug_show_all_locks(void);
5252
extern void debug_show_held_locks(struct task_struct *task);
5353
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);
5555
#else
5656
static inline void debug_show_all_locks(void)
5757
{
@@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len)
6767
}
6868

6969
static inline void
70-
debug_check_no_locks_held(struct task_struct *task)
70+
debug_check_no_locks_held(void)
7171
{
7272
}
7373
#endif

kernel/exit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ void do_exit(long code)
835835
/*
836836
* Make sure we are holding no locks:
837837
*/
838-
debug_check_no_locks_held(tsk);
838+
debug_check_no_locks_held();
839839
/*
840840
* We can do this unlocked here. The futex code uses this flag
841841
* just to verify whether the pi state cleanup has been done

kernel/lockdep.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4090,7 +4090,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
40904090
}
40914091
EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
40924092

4093-
static void print_held_locks_bug(struct task_struct *curr)
4093+
static void print_held_locks_bug(void)
40944094
{
40954095
if (!debug_locks_off())
40964096
return;
@@ -4099,22 +4099,21 @@ static void print_held_locks_bug(struct task_struct *curr)
40994099

41004100
printk("\n");
41014101
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));
41034104
print_kernel_ident();
41044105
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);
41094107
printk("\nstack backtrace:\n");
41104108
dump_stack();
41114109
}
41124110

4113-
void debug_check_no_locks_held(struct task_struct *task)
4111+
void debug_check_no_locks_held(void)
41144112
{
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();
41174115
}
4116+
EXPORT_SYMBOL_GPL(debug_check_no_locks_held);
41184117

41194118
void debug_show_all_locks(void)
41204119
{

0 commit comments

Comments
 (0)