mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
Kernel: Disable profiling during the critical section of sys$execve()
Since we're gonna throw away these stacks at the end of exec anyway, we might as well disable profiling before starting to mess with the process page tables. One less weird situation to worry about in the sampling code.
This commit is contained in:
parent
4420284125
commit
ece2971112
1 changed files with 5 additions and 1 deletions
|
@ -804,6 +804,10 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
return -ETXTBSY;
|
||||
}
|
||||
|
||||
// Disable profiling temporarily in case it's running on this process.
|
||||
bool was_profiling = is_profiling();
|
||||
TemporaryChange profiling_disabler(m_profiling, false);
|
||||
|
||||
auto old_page_directory = move(m_page_directory);
|
||||
auto old_regions = move(m_regions);
|
||||
m_page_directory = PageDirectory::create_for_userspace(*this);
|
||||
|
@ -1015,7 +1019,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
kprintf("Process %u (%s) exec'd %s @ %p\n", pid(), name().characters(), path.characters(), tss.eip);
|
||||
#endif
|
||||
|
||||
if (is_profiling())
|
||||
if (was_profiling)
|
||||
Profiling::did_exec(path);
|
||||
|
||||
new_main_thread->set_state(Thread::State::Skip1SchedulerPass);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue