[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200706231402.03617.arnd@arndb.de>
Date: Sat, 23 Jun 2007 14:02:03 +0200
From: Arnd Bergmann <arnd@...db.de>
To: "Robert P. J. Day" <rpjday@...dspring.com>
Cc: Florin Iucha <florin@...ha.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: "upping" a semaphore from interrupt context?
On Saturday 23 June 2007, Robert P. J. Day wrote:
> On Fri, 22 Jun 2007, Arnd Bergmann wrote:
> >
> > yes, but you should not. The use of semaphores is not recommended
> > for new code, it should be replaced with either a mutex or a
> > completion.
>
> can you clarify this? it sounds like you're saying that the current
> implementation of semaphores is entirely superfluous. but surely it
> isn't possible to replace all semaphores with either mutexes or
> completions, is it?
No, not all of them, but the vast majority. There are multiple
differences, the most important one being the 'counting' in
semaphores. You can e.g. define a semaphore that can be held
by N users at the same time, but not more. In a mutex, N is
by definition 1, so only one thread can hold a mutex.
There are other subtle differences in the implementation, e.g.
you cannot mutex_trylock at interrupt time.
Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists