aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-07-03 03:24:54 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-03 18:27:04 -0400
commit8a25d5debff2daee280e83e09d8c25d67c26a972 (patch)
tree3bccfef9acb66fc62863bfd6c16493c5e8c8e394 /kernel/sched.c
parent4ea2176dfa714882e88180b474e4cbcd888b70af (diff)
[PATCH] lockdep: prove spinlock rwlock locking correctness
Use the lock validator framework to prove spinlock and rwlock locking correctness. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 911829966534..ae4db0185bb2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -308,6 +308,13 @@ static inline void finish_lock_switch(runqueue_t *rq, task_t *prev)
308 /* this is a valid case when another task releases the spinlock */ 308 /* this is a valid case when another task releases the spinlock */
309 rq->lock.owner = current; 309 rq->lock.owner = current;
310#endif 310#endif
311 /*
312 * If we are tracking spinlock dependencies then we have to
313 * fix up the runqueue lock - which gets 'carried over' from
314 * prev into current:
315 */
316 spin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);
317
311 spin_unlock_irq(&rq->lock); 318 spin_unlock_irq(&rq->lock);
312} 319}
313 320
@@ -1778,6 +1785,7 @@ task_t * context_switch(runqueue_t *rq, task_t *prev, task_t *next)
1778 WARN_ON(rq->prev_mm); 1785 WARN_ON(rq->prev_mm);
1779 rq->prev_mm = oldmm; 1786 rq->prev_mm = oldmm;
1780 } 1787 }
1788 spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
1781 1789
1782 /* Here we just switch the register state and the stack. */ 1790 /* Here we just switch the register state and the stack. */
1783 switch_to(prev, next, prev); 1791 switch_to(prev, next, prev);
@@ -4384,6 +4392,7 @@ asmlinkage long sys_sched_yield(void)
4384 * no need to preempt or enable interrupts: 4392 * no need to preempt or enable interrupts:
4385 */ 4393 */
4386 __release(rq->lock); 4394 __release(rq->lock);
4395 spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
4387 _raw_spin_unlock(&rq->lock); 4396 _raw_spin_unlock(&rq->lock);
4388 preempt_enable_no_resched(); 4397 preempt_enable_no_resched();
4389 4398
@@ -4447,6 +4456,7 @@ int cond_resched_lock(spinlock_t *lock)
4447 spin_lock(lock); 4456 spin_lock(lock);
4448 } 4457 }
4449 if (need_resched() && __resched_legal()) { 4458 if (need_resched() && __resched_legal()) {
4459 spin_release(&lock->dep_map, 1, _THIS_IP_);
4450 _raw_spin_unlock(lock); 4460 _raw_spin_unlock(lock);
4451 preempt_enable_no_resched(); 4461 preempt_enable_no_resched();
4452 __cond_resched(); 4462 __cond_resched();