]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
OPTIM: i386: make use of kernel-mode-linux when available
authorWilly Tarreau <w@1wt.eu>
Mon, 18 Jun 2012 18:01:30 +0000 (20:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Jul 2012 05:53:42 +0000 (07:53 +0200)
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

index a4927e2d20b6ad4c7d72f3224d9a5ab51a388b66..1bdd9e9d7cd2e2956b018d085f62cd446719b80d 100644 (file)
@@ -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