Re: [PATCH v0] add nano semaphore in kernel

Arnd Bergmann
2010-12-29T11:48:09Z

On Tuesday 28 December 2010 16:51:30 Daniel Walker wrote:
> We for sure don't want new semaphores, or new semaphore usage in the
> kernel ..

Yes. I once even tried unifying the semaphore and rwsem implementation,
but gave up on that for a number of reasons.

> It should also be noted that the rtmutex (kernel/rtmutex.c) already has
> this capability. Although I don't think you can use an rtmutex from
> inside the kernel.

I wasn't aware we had already grown another one ;-)

AFAICT, you can only use it inside of the kernel, but it's very
specific and I wouldn't recommend using it unless a regular mutex
cannot be used for some reason. The only user besides the futex
code seems to be the i2c layer at this moment.

> If you really want this you should look into the rtmutex, and the
> regular mutex API's .

If Hillf relies on counting semaphores, that won't work, but very
few such users exist in code outside of textbooks.

Arnd