RHEL-RT VDSOHowto
From RHEL-RT
gettimeofday(2) speedup
Many application workloads (ie database, financial service applications) perform extremely frequent gettimeofday() (or similar time functions) calls. Hence there can be major benefit in optimizing the efficiency of this call. To this end, there is a capability referred to as VDSO - which is implemented in the glibc runtime library, it maps some kernel code, which is necessary to read gettimeofday into user space. Currently this is implemented for x86-64 only - not x86.
Standard RHEL5 - VDSO enabled gettimeofday(2) allows the gettimeofday function to be performed entirely in userspace, obviating the system call overhead. This capability exists in standard RHEL5. This VDSO behavior is not enabled by default and must be enabled on a global basis via:
echo 1 > /proc/sys/kernel/vsyscall64
Realtime enhancement - In addition to the above, in the MRG Realtime codebase there is a further gettimeofday performance optimization - which effectively caches recently used time value in a system global. If another gettimeofday call has been performed within the last ms (hz) then it is not necessary to incur the overhead of re-reading the hardware clock value. In this manner, applications which do not require microsecond precision benefit from this performance enhancement. This behavior is not enabled by default and must be enabled on a global basis just like in RHEL5.
To make that setting persistent between reboots and make it effective now, just run the following command line:
echo "kernel.vsyscall64 = 2" >> /etc/sysctl.conf; /sbin/sysctl -w kernel.vsyscall64=2
