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.
#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