Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17470
b: refs/heads/master
c: 408894e
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Ingo Molnar committed Jan 9, 2006
1 parent 03bd85e commit f07c19e
Show file tree
Hide file tree
Showing 8 changed files with 638 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f3f54ffa703c6298240ffd69616451d645bae4d5
refs/heads/master: 408894ee4dd4debfdedd472eb4d8414892fc90f6
21 changes: 21 additions & 0 deletions trunk/include/linux/mutex-debug.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef __LINUX_MUTEX_DEBUG_H
#define __LINUX_MUTEX_DEBUG_H

/*
* Mutexes - debugging helpers:
*/

#define __DEBUG_MUTEX_INITIALIZER(lockname) \
, .held_list = LIST_HEAD_INIT(lockname.held_list), \
.name = #lockname , .magic = &lockname

#define mutex_init(sem) __mutex_init(sem, __FUNCTION__)

extern void FASTCALL(mutex_destroy(struct mutex *lock));

extern void mutex_debug_show_all_locks(void);
extern void mutex_debug_show_held_locks(struct task_struct *filter);
extern void mutex_debug_check_no_locks_held(struct task_struct *task);
extern void mutex_debug_check_no_locks_freed(const void *from, const void *to);

#endif
5 changes: 5 additions & 0 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,11 @@ struct task_struct {
/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
spinlock_t proc_lock;

#ifdef CONFIG_DEBUG_MUTEXES
/* mutex deadlock detection */
struct mutex_waiter *blocked_on;
#endif

/* journalling filesystem info */
void *journal_info;

Expand Down
1 change: 1 addition & 0 deletions trunk/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
rcupdate.o intermodule.o extable.o params.o posix-timers.o \
kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o

obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o
obj-$(CONFIG_FUTEX) += futex.o
obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
obj-$(CONFIG_SMP) += cpu.o spinlock.o
Expand Down
4 changes: 4 additions & 0 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,10 @@ static task_t *copy_process(unsigned long clone_flags,
}
#endif

#ifdef CONFIG_DEBUG_MUTEXES
p->blocked_on = NULL; /* not blocked yet */
#endif

p->tgid = p->pid;
if (clone_flags & CLONE_THREAD)
p->tgid = current->tgid;
Expand Down
Loading

0 comments on commit f07c19e

Please sign in to comment.