Kernel: Don't lock scheduler while updating thread scheduling times

We can use simple atomic variables with relaxed ordering for this,
and avoid locking altogether.
This commit is contained in:
Andreas Kling 2022-08-19 13:54:14 +02:00
commit 806ade1367
Notes: sideshowbarker 2024-07-17 10:54:57 +09:00
2 changed files with 5 additions and 6 deletions

View file

@ -667,8 +667,7 @@ void Thread::update_time_scheduled(u64 current_scheduler_time, bool is_kernel, b
Scheduler::add_time_scheduled(delta, is_kernel);
auto& total_time = is_kernel ? m_total_time_scheduled_kernel : m_total_time_scheduled_user;
SpinlockLocker scheduler_lock(g_scheduler_lock);
total_time += delta;
total_time.fetch_add(delta, AK::memory_order_relaxed);
}
}
if (no_longer_running)