mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Kernel: Avoid allocations in the VMObject constructor
This avoids allocations in the VMObject constructor. The number of inline elements was determined empirically and covers most common cases including LibC malloc.
This commit is contained in:
parent
596361791c
commit
6f38ce8f47
Notes:
sideshowbarker
2024-07-18 16:59:39 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/6f38ce8f47f Pull-request: https://github.com/SerenityOS/serenity/pull/7703
1 changed files with 3 additions and 3 deletions
|
@ -42,8 +42,8 @@ public:
|
|||
virtual bool is_contiguous() const { return false; }
|
||||
|
||||
size_t page_count() const { return m_physical_pages.size(); }
|
||||
const Vector<RefPtr<PhysicalPage>>& physical_pages() const { return m_physical_pages; }
|
||||
Vector<RefPtr<PhysicalPage>>& physical_pages() { return m_physical_pages; }
|
||||
const Vector<RefPtr<PhysicalPage>, 16>& physical_pages() const { return m_physical_pages; }
|
||||
Vector<RefPtr<PhysicalPage>, 16>& physical_pages() { return m_physical_pages; }
|
||||
|
||||
size_t size() const { return m_physical_pages.size() * PAGE_SIZE; }
|
||||
|
||||
|
@ -71,7 +71,7 @@ protected:
|
|||
void for_each_region(Callback);
|
||||
|
||||
IntrusiveListNode<VMObject> m_list_node;
|
||||
Vector<RefPtr<PhysicalPage>> m_physical_pages;
|
||||
Vector<RefPtr<PhysicalPage>, 16> m_physical_pages;
|
||||
Lock m_paging_lock { "VMObject" };
|
||||
|
||||
mutable SpinLock<u8> m_lock;
|
||||
|
|
Loading…
Reference in a new issue