| From 4428443fda5b0b1ed5cca81f06ff378d4d12250b Mon Sep 17 00:00:00 2001 |
| From: Thomas Gleixner <tglx@linutronix.de> |
| Date: Sun, 26 Jul 2009 18:39:41 +0200 |
| Subject: [PATCH] sched: Add lock_count to task struct |
| |
| commit 53e9ba175098c8f13e2cc0a45f3b586a22a4ffd3 in tip. |
| |
| Debugging interface. |
| |
| Signed-off-by: Thomas Gleixner <tglx@linutronix.de> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/include/linux/sched.h b/include/linux/sched.h |
| index bdd186d..dea1e05 100644 |
| --- a/include/linux/sched.h |
| +++ b/include/linux/sched.h |
| @@ -1474,6 +1474,26 @@ struct task_struct { |
| gfp_t lockdep_reclaim_gfp; |
| #endif |
| |
| +/* realtime bits */ |
| + |
| +#define MAX_PREEMPT_TRACE 25 |
| +#define MAX_LOCK_STACK MAX_PREEMPT_TRACE |
| +#ifdef CONFIG_DEBUG_PREEMPT |
| + int lock_count; |
| +# ifdef CONFIG_PREEMPT_RT |
| + struct rt_mutex *owned_lock[MAX_LOCK_STACK]; |
| +# endif |
| +#endif |
| +#ifdef CONFIG_DETECT_SOFTLOCKUP |
| + unsigned long softlockup_count; /* Count to keep track how long the |
| + * thread is in the kernel without |
| + * sleeping. |
| + */ |
| +#endif |
| +#ifdef CONFIG_DEBUG_RT_MUTEXES |
| + void *last_kernel_lock; |
| +#endif |
| + |
| /* journalling filesystem info */ |
| void *journal_info; |
| |
| diff --git a/kernel/fork.c b/kernel/fork.c |
| index 84507ab..8453327 100644 |
| --- a/kernel/fork.c |
| +++ b/kernel/fork.c |
| @@ -943,6 +943,9 @@ static void rt_mutex_init_task(struct task_struct *p) |
| #ifdef CONFIG_RT_MUTEXES |
| plist_head_init_raw(&p->pi_waiters, &p->pi_lock); |
| p->pi_blocked_on = NULL; |
| +# ifdef CONFIG_DEBUG_RT_MUTEXES |
| + p->last_kernel_lock = NULL; |
| +# endif |
| #endif |
| } |
| |
| @@ -1167,6 +1170,9 @@ static struct task_struct *copy_process(unsigned long clone_flags, |
| retval = copy_thread(clone_flags, stack_start, stack_size, p, regs); |
| if (retval) |
| goto bad_fork_cleanup_io; |
| +#ifdef CONFIG_DEBUG_PREEMPT |
| + p->lock_count = 0; |
| +#endif |
| |
| if (pid != &init_struct_pid) { |
| retval = -ENOMEM; |
| -- |
| 1.7.1.1 |
| |