On Sun, 1 Dec 2002, Linus Torvalds wrote:
> 
> The problem appears to be that the DRM people are used to using semaphores
> to protect kernel data structures. That is WRONG.

Follow-up, just in case somebody asks "what are semaphores there for 
then?"

There are reasons to use semaphores, but they are not about protecting
data structures. They are mainly useful for protecting whole subsystems of
code, notably in filesystems where we use semaphores extensively to
protect things like concurrent access to a directory while doing lookups
on it.

Examples:

 - directory cache lookups (kernel "dcache" data structure):

        protected by "dcache_lock" spinlock

 - VFS callback into filesystem to do a lookup that wasn't cached

        protected by per-directory inode semaphore

Basically, spinlocks protect data, while semaphores are more of a
high-level "protect the concept" thing.

I suspect that there is very little in the DRI code that would ever have a
good reason to use a semaphore, they just shouldn't be used at that kind
of low level (they might be useful for doing things like serializing
device opening etc, so I'm not saying that DRI should never ever use one,
but you get the idea)

                Linus



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to