Re: Re: msleep() on recursivly locked mutexes
From: Julian Elischer <julian@xxxxxxxxxxxx>
Basically you shouldn't have a recursed mutex FULL STOP. We have a couple
of instances in the kernel where we allow a mutex to recurse, but they had to be
hard fought, and the general rule is "Don't". If you are recursing on
a mutex you need to switch to some other method of doing things.
e.g. reference counts, turnstiles, whatever.. use the mutex to create these
One typical problem is when someone holds a mutex
and needs to call a function that also tried to get the mutex.
The typical solution for it is to provide two versions of
this function, one expecting the mutex being already held
by the caller, the other being a wrapper that grabs the mutex and
then calls the actual worker function.
-SB
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
Relevant Pages
- Re: msleep() on recursivly locked mutexes
... Further the idea that holding a mutex "except for when we sleep" is a ... Maybe what you need to do is write a small document on how the USB side should work, and what needs to be locked, and enter into a cooperative partnership with some other people who are active in the locking side of things to produce an optimal locking strategy for your module. ... We have a couple of instances in the kernel where we allow a mutex to recurse, but they had to be hard fought, and the general rule is "Don't". ... (freebsd-hackers) - Re: msleep() on recursivly locked mutexes
... Sergey Babkin wrote: ... We have a couple of instances in the kernel where we allow a mutex to recurse, but they had to be hard fought, and the general rule is "Don't". ... (freebsd-hackers) - [ANNOUNCE] Linux 2.6 Real Time Kernel - 2 (Mutex Patch)
... and the Linux system semaphore. ... +and task preemption latency in the current 2.6 kernel series. ... +- Priority Interiting Kernel Mutex substituting spinlocks in critical regions. ... (Linux-Kernel) - [PATCH 4/8] adaptive real-time lock support
... The Real Time patches to the Linux kernel converts the architecture ... compromising the integrity of critical sections protected by the lock. ... while retaining both the priority inheritance protocol as well as the ... the RT Mutex has been ... (Linux-Kernel) - Re: Priority Inheritance Test (Real-Time Preemption)
... That would indeed demand that the kernel would be Oin a lot of places ... subsystems can be used in real-time applications as well. ... resources with non-real-time applications. ... if the same mechanism is used for a userspace mutex there will be ... (Linux-Kernel) |
|