Re: [PATCH v0] add nano semaphore in kernel

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Arnd Bergmann
Date: Wednesday, December 29, 2010 - 12:16 pm

On Wednesday 29 December 2010 15:42:36 Hillf Danton wrote:

Most of the file systems are for compatibility with other operating systems.
The ones that duplicate Linux-only functionality are there in order to provide
backwards-compatibility with existing users. We can't remove them in the
same way that we would remove code that is only used in the kernel itself.


There are more of these, and they partly exist because it has been hard
to change all the old users. We did remove some others though.


These two are subtly different, timers are optimized for not expiring, while
hrtimer is optimized for actually expiring.


That could be changed using the C implementation everywhere,
but there are other problems.


There are three classes of semaphore users today:

1. Those that initialize the semaphore to >1, guarding access to a
   resource that has multiple users: acpi/osl, mthca, mlx4, megaraid,
   comedi/vmk80xx, udlfb, usblc, usb-skeleton, blizzard, hwa742, and 9p.
2. Those that use the semaphore as some sort of completion, or a combination
   of completion and mutex.
3. Those that can and should be converted to mutex: most of the staging
   drivers, plus some more.

IMHO it would be nice to separate the first two classes in some way, so we
can make the counting semaphores stricter and apply the same rules as
mutexes and make the completion-like semaphores non-counting.


There is currently no mutex_lock_timeout(), so that would be meaningless.


Doing this would be extremely inefficient, because now the mutex wait
function would wake up very frequently instead of just once when the
mutex has been released by another thread.

	Arnd
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v0] add nano semaphore in kernel, Hillf Danton, (Sat Dec 25, 10:13 pm)
Re: [PATCH v0] add nano semaphore in kernel, Rakib Mullick, (Sat Dec 25, 11:46 pm)
Re: [PATCH v0] add nano semaphore in kernel, Hillf Danton, (Sun Dec 26, 12:04 am)
Re: [PATCH v0] add nano semaphore in kernel, Rakib Mullick, (Sun Dec 26, 2:08 am)
Re: [PATCH v0] add nano semaphore in kernel, Hillf Danton, (Sun Dec 26, 5:05 am)
Re: [PATCH v0] add nano semaphore in kernel, Rakib Mullick, (Sun Dec 26, 5:56 am)
Re: [PATCH v0] add nano semaphore in kernel, Hillf Danton, (Mon Dec 27, 7:04 am)
Re: [PATCH v0] add nano semaphore in kernel, Randy Dunlap, (Mon Dec 27, 1:08 pm)
Re: [PATCH v0] add nano semaphore in kernel, Arnd Bergmann, (Mon Dec 27, 2:15 pm)
Re: [PATCH v0] add nano semaphore in kernel, Hillf Danton, (Tue Dec 28, 6:13 am)
Re: [PATCH v0] add nano semaphore in kernel, Daniel Walker, (Tue Dec 28, 8:51 am)
Re: [PATCH v0] add nano semaphore in kernel, Arnd Bergmann, (Wed Dec 29, 4:47 am)
Re: [PATCH v0] add nano semaphore in kernel, Hillf Danton, (Wed Dec 29, 7:42 am)
Re: [PATCH v0] add nano semaphore in kernel, Hillf Danton, (Wed Dec 29, 7:57 am)
Re: [PATCH v0] add nano semaphore in kernel, Daniel Walker, (Wed Dec 29, 7:58 am)
Re: [PATCH v0] add nano semaphore in kernel, Hillf Danton, (Wed Dec 29, 8:03 am)
Re: [PATCH v0] add nano semaphore in kernel, Arnd Bergmann, (Wed Dec 29, 12:16 pm)
Re: [PATCH v0] add nano semaphore in kernel, Hillf Danton, (Thu Dec 30, 7:21 am)
Re: [PATCH v0] add nano semaphore in kernel, Arnd Bergmann, (Thu Dec 30, 8:56 am)
Re: [PATCH v0] add nano semaphore in kernel, Pavel Machek, (Tue Jan 4, 7:03 am)
Re: [PATCH v0] add nano semaphore in kernel, Hillf Danton, (Tue Jan 4, 7:18 am)