Re: [PATCH] rwsem: reduce spinlock contention in wakeup code path

From: Waiman Long
Date: Mon Sep 30 2013 - 11:58:59 EST


On 09/28/2013 03:33 PM, Linus Torvalds wrote:
On Sat, Sep 28, 2013 at 12:21 PM, Ingo Molnar<mingo@xxxxxxxxxx> wrote:
If we do that then I suspect the next step will be queued rwlocks :-/ The
current rwlock_t implementation is rather primitive by modern standards.
(We'd probably have killed rwlock_t long ago if not for the
tasklist_lock.)
Yeah, I'm not happy about or rwlocks. That's one lock that currently
is so broken that I think we could easily argue for making that one
queued.

Waiman had a qrwlock series that looked reasonable, and I think his
later versions were drop-in replacements (ie they automatically just
did the RightThing(tm) wrt interrupts taking a recursive read lock - I
objected to the first versions that required that to be stated
explicitly).

The latest version (v3) will allow recursive read lock in interrupt handlers.

I think Waiman's patches (even the later ones) made the queued rwlocks
be a side-by-side implementation with the old rwlocks, and I think
that was just being unnecessarily careful. It might be useful for
testing to have a config option to switch between the two, but we
might as well go all the way.

It is not actually a side-by-side implementation. A user can choose either regular rwlock or the queue one, but never both by setting a configuration parameter. However, I now think that maybe we should do it the lockref way by pre-determining it on a per-architecture level without user visible configuration option.

-Longman
--
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/