Re: Intel P6 vs P7 system call performance

Linus Torvalds (torvalds@transmeta.com)
Tue, 17 Dec 2002 11:28:09 -0800 (PST)


On Tue, 17 Dec 2002, Linus Torvalds wrote:
>
> Hmm.. Which system calls have all six parameters? I'll have to see if I
> can find any way to make those use the new interface too.

The only ones I found from a quick grep are
- sys_recvfrom
- sys_sendto
- sys_mmap2()
- sys_ipc()

and none of them are of a kind where the system call entry itself is the
biggest performance issue (and sys_ipc() is deprecated anyway), so it's
probably acceptable to just use the old interface for them.

One other alternative is to change the calling convention for the
new-style system call, and not have arguments in registers at all. We
could make the interface something like

- %eax contains system call number
- %edx contains pointer to argument block
- call *syscallptr // trashes all registers

and then the old "compatibility" function would be something like

movl 0(%edx),%ebx
movl 4(%edx),%ecx
movl 12(%edx),%esi
movl 16(%edx),%edi
movl 20(%edx),%ebp
movl 8(%edx),%edx
int $0x80
ret

while the "sysenter" interface would do the loads from kernel space.

That would make some things easier, but the problem with this approach is
that if you have a single-argument system call, and you just pass in the
stack pointer offset in %edx directly, then the system call stubs will
always load 6 arguments, and if we're just at the end of the stack it
won't actually _work_. So part of the calling convention would have to be
the guarantee that there is stack-space available (should always be true
in practice, of course).

Linus

-
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/