mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Kernel: Reduce kmallocing in all_processes() and all_pids().
This commit is contained in:
parent
2533e0b57b
commit
1debc0a78c
1 changed files with 2 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue