Kernel: Switch Region to IntrusiveList from InlineLinkedList

This commit is contained in:
Brian Gianforcaro 2021-05-26 02:47:47 -07:00 committed by Andreas Kling
parent e0da61f9d6
commit e6f73d69a2
Notes: sideshowbarker 2024-07-18 17:21:35 +09:00
3 changed files with 12 additions and 13 deletions

View file

@ -855,18 +855,18 @@ void MemoryManager::register_region(Region& region)
{
ScopedSpinLock lock(s_mm_lock);
if (region.is_kernel())
m_kernel_regions.append(&region);
m_kernel_regions.append(region);
else
m_user_regions.append(&region);
m_user_regions.append(region);
}
void MemoryManager::unregister_region(Region& region)
{
ScopedSpinLock lock(s_mm_lock);
if (region.is_kernel())
m_kernel_regions.remove(&region);
m_kernel_regions.remove(region);
else
m_user_regions.remove(&region);
m_user_regions.remove(region);
}
void MemoryManager::dump_kernel_regions()

View file

@ -233,8 +233,8 @@ private:
NonnullRefPtrVector<PhysicalRegion> m_user_physical_regions;
NonnullRefPtrVector<PhysicalRegion> m_super_physical_regions;
InlineLinkedList<Region> m_user_regions;
InlineLinkedList<Region> m_kernel_regions;
Region::List m_user_regions;
Region::List m_kernel_regions;
Vector<UsedMemoryRange> m_used_memory_ranges;
Vector<PhysicalMemoryRange> m_physical_memory_ranges;
Vector<ContiguousReservedMemoryRange> m_reserved_memory_ranges;

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/EnumBits.h>
#include <AK/InlineLinkedList.h>
#include <AK/IntrusiveList.h>
#include <AK/String.h>
#include <AK/WeakPtr.h>
#include <AK/Weakable.h>
@ -29,8 +29,7 @@ enum class ShouldFlushTLB {
};
class Region final
: public InlineLinkedListNode<Region>
, public Weakable<Region>
: public Weakable<Region>
, public PurgeablePageRanges {
friend class MemoryManager;
@ -211,10 +210,6 @@ public:
void remap();
// For InlineLinkedListNode
Region* m_next { nullptr };
Region* m_prev { nullptr };
bool remap_vmobject_page_range(size_t page_index, size_t page_count);
bool is_volatile(VirtualAddress vaddr, size_t size) const;
@ -267,6 +262,10 @@ private:
bool m_mmap : 1 { false };
bool m_syscall_region : 1 { false };
WeakPtr<Process> m_owner;
IntrusiveListNode<Region> m_list_node;
public:
using List = IntrusiveList<Region, RawPtr<Region>, &Region::m_list_node>;
};
AK_ENUM_BITWISE_OPERATORS(Region::Access)