summaryrefslogtreecommitdiff
path: root/Kernel/API
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-01-10 17:25:01 +0100
committerAndreas Kling <kling@serenityos.org>2023-01-10 19:32:31 +0100
commit5dcc58d54ac7057f092ac9287a853e78015007c8 (patch)
tree4e29874073255df53aca9da8a866eed5a5c0ca52 /Kernel/API
parent491edaffc708d5174a0126244d3cd99fc05290e3 (diff)
downloadserenity-5dcc58d54ac7057f092ac9287a853e78015007c8.zip
Kernel+LibCore: Make %sid path parsing not take ages
Before this patch, Core::SessionManagement::parse_path_with_sid() would figure out the root session ID by sifting through /sys/kernel/processes. That file can take quite a while to generate (sometimes up to 40ms on my machine, which is a problem on its own!) and with no caching, many of our programs were effectively doing this multiple times on startup when unveiling something in /tmp/session/%sid/ While we should find ways to make generating /sys/kernel/processes fast again, this patch addresses the specific problem by introducing a new syscall: sys$get_root_session_id(). This extracts the root session ID by looking directly at the process table and takes <1ms instead of 40ms. This cuts WebContent process startup time by ~100ms on my machine. :^)
Diffstat (limited to 'Kernel/API')
-rw-r--r--Kernel/API/Syscall.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Kernel/API/Syscall.h b/Kernel/API/Syscall.h
index 0d0a0555ee..b58efd4737 100644
--- a/Kernel/API/Syscall.h
+++ b/Kernel/API/Syscall.h
@@ -81,6 +81,7 @@ enum class NeedsBigProcessLock {
S(futex, NeedsBigProcessLock::Yes) \
S(get_dir_entries, NeedsBigProcessLock::Yes) \
S(get_process_name, NeedsBigProcessLock::Yes) \
+ S(get_root_session_id, NeedsBigProcessLock::No) \
S(get_stack_bounds, NeedsBigProcessLock::No) \
S(get_thread_name, NeedsBigProcessLock::Yes) \
S(getcwd, NeedsBigProcessLock::No) \