Showing error 1117

User: Jiri Slaby
Error type: Double Lock
Error type description: Some lock is locked twice unintentionally in a sequence
File location: kernel/sched.c
Line in file: 2836
Project: Linux Kernel
Project version: 2.6.28
Tools: Clang Static Analyzer (3.0)
Entered: 2012-04-17 12:29:30 UTC


Source:

2806{
2807        spin_unlock(&rq1->lock);
2808        if (rq1 != rq2)
2809                spin_unlock(&rq2->lock);
2810        else
2811                __release(rq2->lock);
2812}
2813
2814/*
2815 * double_lock_balance - lock the busiest runqueue, this_rq is locked already.
2816 */
2817static int double_lock_balance(struct rq *this_rq, struct rq *busiest)
2818        __releases(this_rq->lock)
2819        __acquires(busiest->lock)
2820        __acquires(this_rq->lock)
2821{
2822        int ret = 0;
2823
2824        if (unlikely(!irqs_disabled())) {
2825                /* printk() doesn't work good under rq->lock */
2826                spin_unlock(&this_rq->lock);
2827                BUG_ON(1);
2828        }
2829        if (unlikely(!spin_trylock(&busiest->lock))) {
2830                if (busiest < this_rq) {
2831                        spin_unlock(&this_rq->lock);
2832                        spin_lock(&busiest->lock);
2833                        spin_lock_nested(&this_rq->lock, SINGLE_DEPTH_NESTING);
2834                        ret = 1;
2835                } else
2836                        spin_lock_nested(&busiest->lock, SINGLE_DEPTH_NESTING);
2837        }
2838        return ret;
2839}
2840
2841static void double_unlock_balance(struct rq *this_rq, struct rq *busiest)
2842        __releases(busiest->lock)
2843{
2844        spin_unlock(&busiest->lock);
2845        lock_set_subclass(&this_rq->lock.dep_map, 0, _RET_IP_);
2846}
Show full sources