Re: [patch 0/9] mutex subsystem, -V4

From: Andrew Morton
Date: Fri Dec 23 2005 - 10:28:00 EST


Xavier Bestel <xavier.bestel@xxxxxxx> wrote:
>
> On Fri, 2005-12-23 at 15:57, Russell King wrote:
> > On Fri, Dec 23, 2005 at 06:51:18AM -0800, Andrew Morton wrote:
> > > Nicolas Pitre <nico@xxxxxxx> wrote:
> > > > How can't you get the fact that semaphores could _never_ be as simple as
> > > > mutexes? This is a theoritical impossibility, which maybe turns out not
> > > > to be so true on x86, but which is damn true on ARM where the fast path
> > > > (the common case of a mutex) is significantly more efficient.
> > >
> > > I did notice your comments. I'll grant that mutexes will save some tens of
> > > fastpath cycles on one minor architecture. Sorry, but that doesn't seem
> > > very important.
> >
> > Wow.
>
> Yes, wow. Andrew doesn't seem aware of embedded linux people, for whom
> cycles are important and ARM is king.
>

Please, spare me the rhetoric.

Adding a new locking primitive is a big deal. We need good reasons for
doing it. And no, I don't think a few cycles on ARM is good enough. I'd
be very surprised if it was measurable - the busiest semaphore is probably
i_sem and when it's taken we're also doing heavy filesystem operations
which would swamp any benefit. And if we're going to churn i_sem then we
perhaps should turn it into an rwsem so we can perform concurrent lookups
(at least). We do disk I/O with that thing held.

Look, I'm not wildly against mutexes - it's not exactly a large amount of
code. I just think they're fairly pointless and I regret that we seem to
be diving into adding yet another locking primitive without having fully
investigated improving the existing one.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/