2004-10-26 21:58:55

by Zachary Amsden

[permalink] [raw]
Subject: [PATCH] faster signal handling on x86

--- 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);


Attachments:
README.i386-fast-signal (918.00 B)
i386-fast-signal.patch (561.00 B)
Download all attachments

2004-10-26 23:15:08

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] faster signal handling on x86



On Tue, 26 Oct 2004, Zachary Amsden wrote:
>
> 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).

I'm suprised it is _that_ slow, but sure, no problem, the patch just makes
it match all the other paths.

I suspect Xeon is alone in being _that_ slow - I bet Netburst flushes the
whole trace cache on db7 writes.

Linus