1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

Kernel: Make AsyncDeviceRequest sub-req management alloc free

The previous implementation could allocate on insertion into the completed / pending
sub request vectors. There's no reason these can't be intrusive lists instead.

This is a very minor step towards improving the ability to handle OOM, as tracked by #6369
It might also help improve performance on the IO path in certain situations.
I'll benchmark that later.
This commit is contained in:
Brian Gianforcaro 2021-04-19 23:55:44 -07:00 committed by Linus Groh
parent f1d832e5ea
commit 033b287635
2 changed files with 22 additions and 19 deletions

View file

@ -26,7 +26,8 @@
#pragma once
#include <AK/NonnullRefPtrVector.h>
#include <AK/IntrusiveList.h>
#include <AK/NonnullRefPtr.h>
#include <Kernel/Process.h>
#include <Kernel/Thread.h>
#include <Kernel/UserOrKernelBuffer.h>
@ -160,8 +161,12 @@ private:
AsyncDeviceRequest* m_parent_request { nullptr };
RequestResult m_result { Pending };
NonnullRefPtrVector<AsyncDeviceRequest> m_sub_requests_pending;
NonnullRefPtrVector<AsyncDeviceRequest> m_sub_requests_complete;
IntrusiveListNode<AsyncDeviceRequest, RefPtr<AsyncDeviceRequest>> m_list_node;
typedef IntrusiveList<AsyncDeviceRequest, RefPtr<AsyncDeviceRequest>, &AsyncDeviceRequest::m_list_node> AsyncDeviceSubRequestList;
AsyncDeviceSubRequestList m_sub_requests_pending;
AsyncDeviceSubRequestList m_sub_requests_complete;
WaitQueue m_queue;
NonnullRefPtr<Process> m_process;
void* m_private { nullptr };