[PATCH RFC 10/11] Adopt kernel/sched.c to lock monitor

From: Hitoshi Mitake
Date: Sun Mar 14 2010 - 06:39:11 EST


There are some points of directly calling the macros spin_{acquire, release}()
and the function lock_set_subclass() in kernel/sched.c.

Now spinlock_t doesn't have struct lockdep_map,
so this patch fixes them with the rule of lock monitor.

Signed-off-by: Hitoshi Mitake <mitake@xxxxxxxxxxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Jens Axboe <jens.axboe@xxxxxxxxxx>
Cc: Jason Baron <jbaron@xxxxxxxxxx>
---
kernel/sched.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 7266b91..6c8a52e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -891,7 +891,7 @@ static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)
* fix up the runqueue lock - which gets 'carried over' from
* prev into current:
*/
- spin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);
+ spin_acquire(&rq->lock.monitor, 0, 0, _THIS_IP_);

raw_spin_unlock_irq(&rq->lock);
}
@@ -1803,7 +1803,7 @@ static inline void double_unlock_balance(struct rq *this_rq, struct rq *busiest)
__releases(busiest->lock)
{
raw_spin_unlock(&busiest->lock);
- lock_set_subclass(&this_rq->lock.dep_map, 0, _RET_IP_);
+ lock_set_subclass(&this_rq->lock.monitor.dep_map, 0, _RET_IP_);
}
#endif

@@ -2905,7 +2905,7 @@ context_switch(struct rq *rq, struct task_struct *prev,
* do an early lockdep release here:
*/
#ifndef __ARCH_WANT_UNLOCKED_CTXSW
- spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
+ spin_release(&rq->lock.monitor, 1, _THIS_IP_);
#endif

/* Here we just switch the register state and the stack. */
@@ -6725,7 +6725,7 @@ SYSCALL_DEFINE0(sched_yield)
* no need to preempt or enable interrupts:
*/
__release(rq->lock);
- spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
+ spin_release(&rq->lock.monitor, 1, _THIS_IP_);
do_raw_spin_unlock(&rq->lock);
preempt_enable_no_resched();

--
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/