Suggestions on Avoiding syscall Overhead
Suleiman Souhlal
ssouhlal at freebsd.org
Thu Apr 26 13:17:09 UTC 2007
On Apr 26, 2007, at 3:24 AM, Peter Jeremy wrote:
> On 2007-Apr-25 01:03:19 -0700, Suleiman Souhlal
> <ssouhlal at freebsd.org> wrote:
>> IMHO, the main usage of the global readonly page is (apart from
>> faster gettimeofday and similar) is that you can put the syscall
>> entry function in it, and have the kernel choose at boot the most
>> efficient method (INT 0x80 or SYSENTER/SYSCALL) based on what the CPU
>> supports, while still having binaries that run everywhere.
>
> That's a nice idea. The only downside I see is that it means the
> page would need to be executable. I would prefer not to have
> data areas executable - even if they are read-only.
Why not?
> I think that FreeBSD should make more use of CPU-specific coding to
> enhance performance. Maybe even something along the lines of Solaris
> where linking to libc implicitly links to a CPU-specific .so if it
> exists.
I have a proof of concept patch that enables the kernel to patch
itself at boot to use certain instructions in certain selected places
based on the CPUID bits: http://people.freebsd.org/~ssouhlal/testing/
bootpatch-20060527.diff .
The patch just prefetches the next element in a list when using
TAILQ/STAILQ/etc_FOREACH() (which is pretty useless), using the
PREFETCHNTA instruction if the CPU supports SSE2 and PREFETCH
otherwise, but it could also be used for potentially more useful
things like using *FENCE instructions in atomic_store/load_rel/acq_*
() when the CPU supports them, instead of LOCK, on i386..
-- Suleiman
More information about the freebsd-current
mailing list