From 4f2520674caa937dedc6572fdf310f5e0ae42074 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sun, 22 Aug 2021 22:03:16 -0600 Subject: [PATCH] Kernel: Don't acquire Mutex for hostname() before scheduling is enabled There's no reason to acquire the mutex for this resource before APs are booted, before scheduling is enabled, and before interrupts are enabled. --- Kernel/Process.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index d434b37738..04959e4203 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -76,9 +76,9 @@ UNMAP_AFTER_INIT void Process::initialize() next_pid.store(0, AK::MemoryOrder::memory_order_release); - hostname().with_exclusive([&](auto& name) { - name = "courage"; - }); + // Note: This is called before scheduling is initialized, and before APs are booted. + // So we can "safely" bypass the lock here. + reinterpret_cast(hostname()) = "courage"; create_signal_trampoline(); }