mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
Kernel: Propagate sys$profiling_enable() buffer allocation failure
Caught a kernel panic when enabling profiling of all threads when there was very little memory available.
This commit is contained in:
parent
c1c5444c14
commit
04539d4930
Notes:
sideshowbarker
2024-07-17 19:44:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/04539d49307
@ -26,10 +26,15 @@ ErrorOr<FlatPtr> Process::sys$profiling_enable(pid_t pid, u64 event_mask)
|
||||
return EPERM;
|
||||
ScopedCritical critical;
|
||||
g_profiling_event_mask = PERF_EVENT_PROCESS_CREATE | PERF_EVENT_THREAD_CREATE | PERF_EVENT_MMAP;
|
||||
if (g_global_perf_events)
|
||||
if (g_global_perf_events) {
|
||||
g_global_perf_events->clear();
|
||||
else
|
||||
} else {
|
||||
g_global_perf_events = PerformanceEventBuffer::try_create_with_size(32 * MiB).leak_ptr();
|
||||
if (!g_global_perf_events) {
|
||||
g_profiling_event_mask = 0;
|
||||
return ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
SpinlockLocker lock(g_profiling_lock);
|
||||
if (!TimeManagement::the().enable_profile_timer())
|
||||
|
Loading…
Reference in New Issue
Block a user