Re: all mutexes -> read-write locks?

[ Available lists | Index of freebsd-arch | Month of Jun 2008 | Week of 2 Jun 2008 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Alfred Perlstein <alfred@freebsd.org>
Date
2 Jun 2008 17:35:38
Subject
Re: all mutexes -> read-write locks?
Message-ID
20080602171946.GJ48790@elvis.mu.org

In reply to

[ Hide this part ]
* Daniel Eischen <eischen@vigrid.com> [080602 10:14] wrote:
> On Mon, 2 Jun 2008, Julian Elischer wrote:
> >
> >how does that help making more things use read locking?
>
> It doesn't, it shows one reason why mutexes can be different
> than read/write locks.
>
> I don't see how most low-level leaf drivers can make use of
> read/write locks. All they want to do is prevent simultaneous
> access to a device and setup I/O operations.
>
> By keeping the mutex and rwlock APIs separate regardless of
> their implementation, you allow the code to specify what kind
> of locking it wants. If you convert all mutexes to rwlocks
> you lose this information and it makes it harder to go back
> again. On the other hand, if you s/mtx_foo/rw_foo/, you still
> have to analyze the code to tell whether or not you can
> truly turn them into simultaneous read locks. So what is
> the harm in analyzing the code first, and then converting
> it to rwlocks IFF it can make use of it?

I agree with Daniel here.

I also think the following points are relevant:

1) we don't need to rototil the code to s/mtx/rw/ right now.
2) rw locks may not be as effecient as mtx later on and there's
no point in doing it right now.

--
- Alfred Perlstein


Elapsed time: 0.122 seconds