mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
Kernel: Reduce kmallocing in all_processes() and all_pids().
This commit is contained in:
parent
2533e0b57b
commit
1debc0a78c
Notes:
sideshowbarker
2024-07-19 14:41:40 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/1debc0a78c6
@ -52,6 +52,7 @@ Vector<pid_t> Process::all_pids()
|
||||
{
|
||||
Vector<pid_t> pids;
|
||||
InterruptDisabler disabler;
|
||||
pids.ensure_capacity(g_processes->size_slow());
|
||||
for (auto* process = g_processes->head(); process; process = process->next())
|
||||
pids.append(process->pid());
|
||||
return pids;
|
||||
@ -61,6 +62,7 @@ Vector<Process*> Process::all_processes()
|
||||
{
|
||||
Vector<Process*> processes;
|
||||
InterruptDisabler disabler;
|
||||
processes.ensure_capacity(g_processes->size_slow());
|
||||
for (auto* process = g_processes->head(); process; process = process->next())
|
||||
processes.append(process);
|
||||
return processes;
|
||||
|
Loading…
Reference in New Issue
Block a user