mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:48:14 +00:00
Kernel: Add fast-path for sys$gettid()
The userspace locks are very aggressively calling sys$gettid() to find out which thread ID they have. Since syscalls are quite heavy, this can get very expensive for some programs. This patch adds a fast-path for sys$gettid(), which makes it skip all of the usual syscall validation and just return the thread ID right away. This cuts Kernel/Process.cpp compile time by ~18%, from ~29 to ~24 sec.
This commit is contained in:
parent
8d9dd1b04b
commit
5ce1cc89a0
1 changed files with 8 additions and 0 deletions
|
@ -119,6 +119,14 @@ int handle(RegisterDump& regs, u32 function, u32 arg1, u32 arg2, u32 arg3)
|
|||
|
||||
void syscall_handler(RegisterDump regs)
|
||||
{
|
||||
// Special handling of the "gettid" syscall since it's extremely hot.
|
||||
// FIXME: Remove this hack once userspace locks stop calling it so damn much.
|
||||
if (regs.eax == SC_gettid) {
|
||||
regs.eax = current->process().sys$gettid();
|
||||
current->did_syscall();
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure SMAP protection is enabled on syscall entry.
|
||||
clac();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue