From: Andrea Arcangeli <andrea@suse.de>
To: David Howells <dhowells@redhat.com>
Cc: ralf@gnu.ai.mit.edu, linux-mips@fnet.fr,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@transmeta.com>
Subject: Re: optimised rw-semaphores for MIPS/MIPS64
Date: Wed, 11 Jul 2001 18:41:14 +0200 [thread overview]
Message-ID: <20010711184114.I3496@athlon.random> (raw)
In-Reply-To: <2508.994860047@warthog.cambridge.redhat.com>
In-Reply-To: <2508.994860047@warthog.cambridge.redhat.com>; from dhowells@redhat.com on Wed, Jul 11, 2001 at 03:00:47PM +0100
On Wed, Jul 11, 2001 at 03:00:47PM +0100, David Howells wrote:
> Hello Ralf,
>
> I've produced an inline-assembly optimised Read/Write Semaphore patch for MIPS
> against linux-2.4.7-pre6 (rwsem.diff). David Woodhouse has tested it.
I don't understand why you keep writing code on top of your
mathematically slower rwsem framework.
the C version is much much slower, measured several times.
The asm version has a inferior slow path design that force you having to
do slower and quite tricky stuff in the up_write fast path. This is your
up_write fast path:
" movl %2,%%edx\n\t"
LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
" jnz 2f\n\t" /* jump if the lock is being waited upon */
Plus you also clobber %dx in the up_write fast path which I don't need
to.
This is my up_write fast path:
__asm__ __volatile__(LOCK "subl %2, %0\n\t"
"js 2f\n"
Also the design of my xadd slow path looks more readable to me but ok,
I'm biased about that, let's only care about the number of cycles you
have to spend on the fast paths as measure of the goodness of the
algorithm.
I'd suggest arch maintainers to port their rwsem asm optimized fast
paths on top of this patch and to submit me patches:
ftp://ftp.us.kernel.org/pub/linux/kernel/people/andrea/kernels/v2.4/2.4.7pre5aa1/00_rwsem-14
I also recommend Linus to include the above patch into mainline (it will
reject on the alpha since in pre6 there is the asm optimized version on
top of the slower framework, you can simply temporary disable the asm
optimized version in alpha/config.in and it will compile just fine).
I have an old one from Ivan for alpha which I can just integrate after
auditing and comparison with the one in pre6, the port of the others
should be fairly easy too.
If arch maintainers will do it and it will be included in mainline this
would save me some work and would make the kernel faster. If it won't
be included again for whatever reason (I got no reply last times) I will
just spend a day on it and I'll port all ports on top of the new code
myself and I'll maintain the faster rwsem in my tree for all archs in
the kernel (possibly with the exception of the ones that are not
converted to the xchgadd asm version yet) as I did so far for x86.
Andrea
prev parent reply other threads:[~2001-07-11 16:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-11 14:00 optimised rw-semaphores for MIPS/MIPS64 David Howells
2001-07-11 14:18 ` David Howells
2001-07-11 16:41 ` Andrea Arcangeli [this message]
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=20010711184114.I3496@athlon.random \
--to=andrea@suse.de \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@fnet.fr \
--cc=ralf@gnu.ai.mit.edu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox