mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:58:11 +00:00
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:
parent
5ada38f9c3
commit
806ade1367
2 changed files with 5 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue