Re: Intel P6 vs P7 system call performance

From: Jamie Lokier (lk@tantalophile.demon.co.uk)
Date: Fri Dec 20 2002 - 07:06:56 EST


This is a suggestion on a small performance improvement.

Ulrich Drepper wrote:
> int $0x80 -> call *%gs:0x18

The calling convention has been (slightly) changed - i.e. 6 argument
calls don't work, so why not go a bit further: allow the vsyscall entry
point to clobber more GPRs?

I see 3 pushes and pops in the vsyscall page (if I've looked at the
correct patch from Linus), to preserve %ecx, %edx and %ebp:

        vsyscall:
                pushl %ebp
                pushl %ecx
                pushl %edx
        0:
                movl %esp,%ebp
                sysenter
                jmp 0b
                popl %edx
                popl %ecx
                popl %ebp
                ret

The benefit is that this allows Glibc to do a wholesale replacement of
"int $0x80" -> "single call instruction". Otherwise, those pushes are
completely unnecessary. It could be this short instead:

        vsyscall:
                movl %esp,%ebp
                sysenter
                jmp vsyscall
                ret

It is nice to be able to use the _exact_ same convention in glibc, for
getting a patch out of the door quickly. But it is just as easy to do
that putting the pushes and pops into the library itself:

Instead of

        int $0x80 -> call *%gs:0x18

Write

        int $0x80 -> pushl %ebp
                        pushl %ecx
                        pushl %edx
                        call *%gs:0x18
                        popl %edx
                        popl %ecx
                        popl %ebp

It has exactly the same cost as the current patches, but provides
userspace with more optimisation flexibility, using an asm clobber
list instead of explicit instructions for inline syscalls, etc.

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



This archive was generated by hypermail 2b29 : Mon Dec 23 2002 - 22:00:26 EST