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

From: Ingo Molnar
Date: Tue Oct 01 2013 - 03:28:24 EST



* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Mon, Sep 30, 2013 at 09:13:52AM -0700, Linus Torvalds wrote:
>
> > So unlike a lot of other "let's try to make our locking fancy" that I
> > dislike because it tends to hide the fundamental problem of
> > contention, the rwlock patches make me go "those actually _fix_ a
> > fundamental problem".
>
> So here I'm slightly disagreeing; fixing a fundamental problem would be
> coming up a better anon_vma management that doesn't create such immense
> chains.

So, I think the fundamental problem seems to be that when rwsems are
applied to this usecase, they still don't perform as well as a primitive
rwlock.

That means that when rwsems cause a context switch it is a loss, while an
rwlock_t burning CPU time by looping around is a win. I'm not sure it's
even about 'immense chains' - if those were true then context-switching
should actually improve performance by allowing other work to continue
while the heavy chains are processed.

Alas that's not what happens!

Or is AIM7 essentially triggering a single large lock? I doubt that's the
case though.

> Its still the same lock, spinlock or not.
>
> And regardless of if we keep anon_vma lock a rwsem or not; I think we
> should merge those rwsem patches as they do improve the lock
> implementation and the hard work has already been done.

That I mostly agree with, except that without a serious usecase do we have
a guarantee that bugs in fancies queueing in rwsems gets ironed out?

Thanks,

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