OPTIM: i386: make use of kernel-mode-linux when available

If haproxy is built with support for USE_VSYSCALL_DLSYM, it's very
easy to check for KML availability. So let's enable it. Tests show
a small overall performance improvement around 1%. Other tests show
that the syscall overhead is divided by 4 on a Geode LX using this
method.
This commit is contained in:
Willy Tarreau 2012-06-18 20:01:30 +02:00
parent a7ad50cdb1
commit 5b88da269c

View File

@ -184,10 +184,14 @@ static void __i386_linux_vsyscall_init(void)
#ifdef USE_VSYSCALL_DLSYM #ifdef USE_VSYSCALL_DLSYM
void *handle = dlopen("linux-gate.so.1", RTLD_NOW); void *handle = dlopen("linux-gate.so.1", RTLD_NOW);
if (handle) { if (handle) {
void *ptr = dlsym(handle, "__kernel_vsyscall"); void *ptr;
dlclose(handle);
ptr = dlsym(handle, "__kernel_vsyscall_kml");
if (!ptr)
ptr = dlsym(handle, "__kernel_vsyscall");
if (ptr) if (ptr)
vsyscall = ptr; vsyscall = ptr;
dlclose(handle);
} }
#else #else
/* Heuristic: trying to mprotect() the VDSO area will only succeed if /* Heuristic: trying to mprotect() the VDSO area will only succeed if