[dm-devel] [PATCH] a deadlock bug in the kernel-side device mapper code
Mikulas Patocka
mpatocka at redhat.com
Fri Nov 6 16:30:47 UTC 2009
On Fri, 6 Nov 2009, Alasdair G Kergon wrote:
> On Thu, Nov 05, 2009 at 09:58:26PM -0500, Mikulas Patocka wrote:
> > +static DEFINE_MUTEX(_name_read_lock);
>
> Any reason for a mutex rather than a spinlock?
There can be both. I basically use the rule "if there can be either
spinlock or mutex, use mutex". Because mutexes don't create scheduling
latency --- i.e. you don't have to check them "how much time can it spend
inside a mutex and how to break a long lock into few smaller locks".
Performance of mutex and spinlock in non-contended case is the same.
Mikulas
More information about the dm-devel
mailing list