From: Willy Tarreau <willy@w.ods.org>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: linux-kernel@vger.kernel.org, davej@redhat.com
Subject: Re: Linux 2.4.30-rc2
Date: Sat, 26 Mar 2005 12:34:26 +0100 [thread overview]
Message-ID: <20050326113426.GO30052@alpha.home.local> (raw)
In-Reply-To: <20050326004631.GC17637@logos.cnet>
Marcelo,
just another one and that's all. Zachary Amsden found an unconditional
write to a debug register in the signal delivery path which is only
needed when we use a breakpoint. This is a very expensive operation on
x86, and doing it conditionnaly enhanced signal delivery speed by 33%
for him.
His patch got merged in 2.6.10, and I've merged it a month ago in my
local tree. Could we get it in 2.4.30, please ?
Thanks in advance,
Willy
--
I noticed an unneeded write to dr7 in the signal handling path for x86.
We only need to write to dr7 if there is a breakpoint to re-enable, and
MOVDR is a serializing instruction, which is expensive. Getting rid of
it gets a 33% faster signal delivery path (at least on Xeon - I didn't
test other CPUs, so your gain may vary).
Cheers,
Zachary Amsden
zach@vmware.com
--------------070400020104010700090602
Content-Type: text/plain;
name="README.i386-fast-signal"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="README.i386-fast-signal"
Optimize away the unconditional write to debug registers on signal delivery
path. This is already done on x86_64. Measured delta TSC for three paths
on a 2.4GHz Xeon.
1) With unconditional write to dr7 : 800-1000 cycles
2) With conditional write to dr7 : 84-112 cycles
3) With unlikely write to dr7 : 84 cycles
Performance test using divzero microbenchmark (3 million divide by zeros):
With unconditional write:
7.445 real / 6.136 system
7.529 real / 6.482 system
7.541 real / 5.974 system
7.546 real / 6.217 system
7.445 real / 6.167 system
With unlikely write:
5.779 real / 4.518 system
5.783 real / 4.591 system
5.552 real / 4.569 system
5.790 real / 4.528 system
5.554 real / 4.382 system
That's about a 33% speedup - more than I expected; apparently getting rid
of the serializing instruction makes the do_signal path much faster.
Zachary Amsden (zach@vmware.com)
--------------070400020104010700090602
Content-Type: text/plain;
name="i386-fast-signal.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="i386-fast-signal.patch"
[hand-edited line numbers to match 2.4]
--- linux-2.6.10-rc1/arch/i386/kernel/signal.c 2004-10-25 11:15:43.000000000 -0700
+++ linux-2.6.10-rc1-nsz/arch/i386/kernel/signal.c 2004-10-26 14:30:54.000000000 -0700
@@ -600,7 +600,9 @@
* have been cleared if the watchpoint triggered
* inside the kernel.
*/
- __asm__("movl %0,%%db7" : : "r" (current->thread.debugreg[7]));
+ if (unlikely(current->thread.debugreg[7])) {
+ __asm__("movl %0,%%db7" : : "r" (current->thread.debugreg[7]));
+ }
/* Whee! Actually deliver the signal. */
handle_signal(signr, &info, &ka, oldset, regs);
next prev parent reply other threads:[~2005-03-26 11:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-26 0:46 Marcelo Tosatti
2005-03-26 10:42 ` Willy Tarreau
2005-03-26 10:50 ` Willy Tarreau
2005-03-26 10:59 ` Willy Tarreau
2005-03-26 21:41 ` David S. Miller
2005-03-26 11:22 ` Willy Tarreau
2005-03-26 11:44 ` Arjan van de Ven
2005-03-26 12:27 ` Willy Tarreau
2005-03-26 16:07 ` Marcelo Tosatti
2005-03-26 11:34 ` Willy Tarreau [this message]
2005-03-26 11:46 ` Arjan van de Ven
2005-03-26 12:29 ` Willy Tarreau
2005-03-27 17:50 ` Andi Kleen
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=20050326113426.GO30052@alpha.home.local \
--to=willy@w.ods.org \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.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
all inboxes | Powered by JetHome®