From 5b88da269c528a399606f35cf13e7dea58eabd90 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 18 Jun 2012 20:01:30 +0200 Subject: [PATCH] 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. --- src/i386-linux-vsys.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/i386-linux-vsys.c b/src/i386-linux-vsys.c index a4927e2d2..1bdd9e9d7 100644 --- a/src/i386-linux-vsys.c +++ b/src/i386-linux-vsys.c @@ -184,10 +184,14 @@ static void __i386_linux_vsyscall_init(void) #ifdef USE_VSYSCALL_DLSYM void *handle = dlopen("linux-gate.so.1", RTLD_NOW); if (handle) { - void *ptr = dlsym(handle, "__kernel_vsyscall"); - dlclose(handle); + void *ptr; + + ptr = dlsym(handle, "__kernel_vsyscall_kml"); + if (!ptr) + ptr = dlsym(handle, "__kernel_vsyscall"); if (ptr) vsyscall = ptr; + dlclose(handle); } #else /* Heuristic: trying to mprotect() the VDSO area will only succeed if