Questions on semaphores

From: Juan M. de la Torre (jmtorre@gmx.net)
Date: Wed Sep 04 2002 - 16:29:31 EST


 Hi people, I have two question regarding the i386 semaphore implementation
 in kernel 2.4.19.
 
 Please dont blame me if they are too obvius; i'm a newbie in kernel hacking
 :)

 The functions __down, __down_interruptible and __down_trylock (defined
 in arch/i386/kernel/semaphore.c) use the global spinlock
 'semaphore_lock' to access some fields of the semaphore they are
 working on:
 
 1) Is there any reason to do this?
 2) Wouldn't it be more scalable to use a per-semaphore lock instead a
    global spinlock?

 The function __down_trylock try to get the spinlock using
 spin_lock_irqsave, instead of using spin_lock_irq:

 1) why? :)

 Thanks in advance,
 Juanma

-- 
/jm

- 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/



This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:23 EST