Reputation: 846
Just searched the Linux kernel for vdso hooks (e.g. found this at kernel.org), and it seems to be currently used mostly for time-related system calls. This brings two questions to mind:
clock_gettime()
really becoming a large enough bottleneck to motivate the design of vDSO? Is there any particular kind of application for which this was helpful? If so, what kind of application and by how much?It just seemed odd to design a new kernel syscall interface for just time lookups. I am guessing it helps high-performance servers for things like timestamping request-responses and logs. But I want to know if anybody here has more concrete details than just guesses.
Upvotes: 3
Views: 396
Reputation: 20720
The vDSO manual page has this to say about the reason for creating this special library:
Why does the vDSO exist at all? There are some system calls the kernel provides that user-space code ends up using frequently, to the point that such calls can dominate overall performance. This is due both to the frequency of the call as well as the context- switch overhead that results from exiting user space and entering the kernel.
Further reading will tell you of the various strategies used to make it possible to share data between the kernel and user space. Especially:
This information is also not secret—any application in any privilege mode (root or any unprivileged user) will get the same answer.
Note: Emphasis mine.
That tells us that the data offered through that vDSO interface has to be public, something that any process running on the system would anyway have access to. This is obviously very important.
So to recap we have two reasons/constraints for adding functions to the vDSO:
If you look further in the vDSO manual page, you will notice lists of functions supported by various implementations (See the *ARCHITECTURE-SPECIFIC NOTES section). This gives us another piece of information: the Linux version when such and such was implemented/accessible. The very first available implementation was in Linux 2.5 (late 2001, note also that was a development version, so the first user available version was 2.6.1 in 2003).
We find the following functions in the vDSO:
sigreturn
rt_sigreturn
sigtramp
sigtramp32
sigtramp_rt32
sigtramp_rt64
syscall_via_break
syscall_via_epc
vsyscall
get_syscall_map
lws_entry
linux_gateway_entry
gettimeofday
clock_gettime
clock_gettime64
clock_getres
time
getcpu
get_tbfreq
sync_dicache
sync_dicache_p5
flush_icache
getpid
getppid
set_tid_address
set_thread_pointer
datapage_offset
So overall we see calls for:
For x86 processors, it is mostly limited to Time and CPU. In i386, there are signal related functions too.
Upvotes: 2