Re: Performance regression from switching lock to rw-sem foranon-vma tree

From: Tim Chen
Date: Fri Jun 14 2013 - 18:44:29 EST



>
> Unfortunately this patch didn't make any difference, in fact it hurt
> several of the workloads even more. I also tried disabling preemption
> when spinning on owner to actually resemble spinlocks, which was my
> original plan, yet not much difference.
>

That's also similar to the performance I got. There are things about
optimistic spinning that I missed that results in the better mutex
performance. So I'm scratching my head.

> A few ideas that come to mind are avoiding taking the ->wait_lock and
> avoid dealing with waiters when doing the optimistic spinning (just like
> mutexes do).
>

For my patch, we actually spin without the wait_lock.

> I agree that we should first deal with the optimistic spinning before
> adding the MCS complexity.
>
> > Matthew and I have also discussed possibly introducing some
> > limited spinning for writer when semaphore is held by read.
> > His idea was to have readers as well as writers set ->owner.
> > Writers, as now, unconditionally clear owner. Readers clear
> > owner if sem->owner == current. Writers spin on ->owner if ->owner
> > is non-NULL and still active. That gives us a reasonable chance
> > to spin since we'll be spinning on
> > the most recent acquirer of the lock.
>
> I also tried implementing this concept on top of your patch, didn't make
> much of a difference with or without it.
>

It also didn't make a difference for me.

Tim

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