It was easy to do.
> 2) Wouldn't it be more scalable to use a per-semaphore lock instead a
> global spinlock?
>
Yes it would be more scalable, but not as much as you would think.
The __down, __down_interruptible and __down_trylock code only gets
invoked when the semaphore is contended for.
> The function __down_trylock try to get the spinlock using
> spin_lock_irqsave, instead of using spin_lock_irq:
>
> 1) why? :)
>
The __down_trylock() code can be called with another lock held. The
spin_lock_irqsave()/spin_lock_irqrestore() interface is used to restore
the irq value for the lock that may already be held.
> Thanks in advance,
> Juanma
>
The code in the 2.5 tree was changed a while back to use the spinlock in
the wait_queue_head_t to replace the global semaphore spin lock. So, this
has been "FIXED" in 2.5.
-- Bob Miller Email: rem@osdl.org Open Source Development Lab Phone: 503.626.2455 Ext. 17 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/