From: David Howells <dhowells@warthog.cambridge.redhat.com>
To: Andrea Arcangeli <andrea@suse.de>
To: David Howells <dhowells@cambridge.redhat.com>
Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: Re: rwsem benchmark [was Re: [PATCH] rw_semaphores, optimisations try #3]
Date: Tue, 24 Apr 2001 11:25:23 +0100 [thread overview]
Message-ID: <6215.988107923@warthog.cambridge.redhat.com> (raw)
In-Reply-To: Your message of "Tue, 24 Apr 2001 11:49:53 +0200." <20010424114953.E7913@athlon.random>
> I'd love to hear this sequence. Certainly regression testing never generated
> this sequence yet but yes that doesn't mean anything. Note that your slow
> path is very different than mine.
One of my testcases fell over on it...
> I don't feel the need of any xchg to enforce additional serialization.
I don't use XCHG anywhere... do you mean CMPXCHG?
> yours plays with cmpxchg in a way that I still cannot understand
It tries not to let the "active count" transition 1->0 happen if it can avoid
it (ie: it would rather wake someone up and not decrement the count). It also
only calls __rwsem_do_wake() if the caller manages to transition the active
count 0->1.
This avoids another subtle bug that I think I have a sequence written down for
too.
> Infact eax will be changed because it will be clobbered by the slow path, so
> I have to. Infact you are not using the +a like I do there and you don't
> save EAX explicitly on the stack I think that's "your" bug.
Not so... my down-failed slowpath functions return sem in EAX.
> Again it's not a performance issue, the "+a" (sem) is a correctness issue
> because the slow path will clobber it.
There must be a performance issue too, otherwise our read up/down fastpaths
are the same. Which clearly they're not.
> About the reason I'm faster than you in the down_write fast path is that I
> can do the subl instead of the cmpxchg, you say this is my big fault, I
> think my algorithm allows me to do that, but maybe I'm wrong.
I used to do that.
> Unfortunatly I "have" to put the pushl there because I don't want to save
> %ecx in the fast path (if I declare ecx clobbered it's even worse no?).
It benchmarked faster without it for me. I suspect this will be different on
different CPUs anyway.
I'm going to have to have a play with Intel's VTUNE program and see what it
says.
> I said on 64bit archs. Of course on x86-64 there is xaddq and the rex
> registers.
But the instructions you've specified aren't 64-bit.
> It isn't mandatory, if you don't want the xchgadd infrastructure then you
> don't set even CONFIG_RWSEM_XCHGADD, no?
My point is that mine isn't mandatory either... You just don't set the XADD
config option.
David
next prev parent reply other threads:[~2001-04-24 10:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-23 20:35 [PATCH] rw_semaphores, optimisations try #3 D.W.Howells
2001-04-23 21:34 ` Andrea Arcangeli
2001-04-24 4:56 ` rwsem benchmark [was Re: [PATCH] rw_semaphores, optimisations try #3] Andrea Arcangeli
2001-04-24 8:56 ` David Howells
2001-04-24 9:49 ` Andrea Arcangeli
2001-04-24 10:25 ` David Howells [this message]
2001-04-24 10:44 ` Andrea Arcangeli
2001-04-24 13:07 ` David Howells
2001-04-24 13:59 ` Andrea Arcangeli
2001-04-24 15:49 ` Linus Torvalds
2001-04-24 10:17 ` Andrea Arcangeli
2001-04-24 10:33 ` David Howells
2001-04-24 10:46 ` Andrea Arcangeli
2001-04-24 12:19 ` Andrea Arcangeli
2001-04-24 13:10 ` Andrea Arcangeli
2001-04-23 22:23 ` [PATCH] rw_semaphores, optimisations try #3 Linus Torvalds
2001-04-24 10:05 ` David Howells
2001-04-24 15:40 ` Linus Torvalds
2001-04-24 16:37 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6215.988107923@warthog.cambridge.redhat.com \
--to=dhowells@warthog.cambridge.redhat.com \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.