{PATCH] Re: wasting time on page fault

From: Brian Gerst (bgerst@didntduck.org)
Date: Wed Oct 04 2000 - 20:42:07 EST


Mikulas Patocka wrote:
>
> Hi.
>
> arch/i386/kernel/entry.S
> xchgl %eax, ORIG_EAX(%esp) # orig_eax (get the error code. )
> movl %esp,%edx
> xchgl %ecx, ES(%esp) # get the address and save es.
> pushl %eax # push the error code
>
> xchg with memory operand has implicit lock prefix and is slooooooow. It is

Here is a patch that removes the xchg instructions. As an interesting
note, I tested the difference in cycles between one xchgl and two movl
instructions on 3 different processors (a Celeron, a K6-2, and an
Athlon, all UP). The celeron and K6-2 showed noticable improvements.
The real surprise was the the Athlon, where the times were identical.
This means that either the Athlon has a really fast lock cycle or it is
ignoring it.

-- 

Brian Gerst

diff -urN linux-2.4.0t9/arch/i386/kernel/entry.S linux/arch/i386/kernel/entry.S --- linux-2.4.0t9/arch/i386/kernel/entry.S Tue Oct 3 20:05:10 2000 +++ linux/arch/i386/kernel/entry.S Wed Oct 4 20:17:09 2000 @@ -305,16 +305,18 @@ pushl %ebx cld movl %es,%ecx - xchgl %eax, ORIG_EAX(%esp) # orig_eax (get the error code. ) + movl ORIG_EAX(%esp), %esi # get the error code + movl ES(%esp), %edi # get the function address + movl %eax, ORIG_EAX(%esp) + movl %ecx, ES(%esp) movl %esp,%edx - xchgl %ecx, ES(%esp) # get the address and save es. - pushl %eax # push the error code - pushl %edx + pushl %esi # push the error code + pushl %edx # push the pt_regs pointer movl $(__KERNEL_DS),%edx movl %edx,%ds movl %edx,%es GET_CURRENT(%ebx) - call *%ecx + call *%edi addl $8,%esp jmp ret_from_exception

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Oct 07 2000 - 21:00:15 EST