1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 12:37:40 +00:00

Kernel: Don't lock the scheduler in ProcFSOverallProcesses::try_generate

This used to be needed to protect accesses to Process::all_instances.
That list now has a more granular lock, so we don't need to take the
scheduler lock.

This fixes a crash when we try to access a locked Thread::m_fds in the
loop, which calls Thread::block, which then asserts that the scheduler
lock must not be locked by the current process.

Fixes #13617
This commit is contained in:
Daniel Bertalan 2022-07-14 11:42:05 +02:00 committed by Andreas Kling
parent 004bb59be5
commit e93d19bbb1

View file

@ -582,23 +582,20 @@ private:
return {}; return {};
}; };
SpinlockLocker lock(g_scheduler_lock);
{ {
{ auto array = TRY(json.add_array("processes"sv));
auto array = TRY(json.add_array("processes"sv)); TRY(build_process(array, *Scheduler::colonel()));
TRY(build_process(array, *Scheduler::colonel())); TRY(Process::all_instances().with([&](auto& processes) -> ErrorOr<void> {
TRY(Process::all_instances().with([&](auto& processes) -> ErrorOr<void> { for (auto& process : processes)
for (auto& process : processes) TRY(build_process(array, process));
TRY(build_process(array, process)); return {};
return {}; }));
})); TRY(array.finish());
TRY(array.finish());
}
auto total_time_scheduled = Scheduler::get_total_time_scheduled();
TRY(json.add("total_time"sv, total_time_scheduled.total));
TRY(json.add("total_time_kernel"sv, total_time_scheduled.total_kernel));
} }
auto total_time_scheduled = Scheduler::get_total_time_scheduled();
TRY(json.add("total_time"sv, total_time_scheduled.total));
TRY(json.add("total_time_kernel"sv, total_time_scheduled.total_kernel));
TRY(json.finish()); TRY(json.finish());
return {}; return {};
} }