mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-02 04:20:28 +00: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
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…
Reference in a new issue