mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:07:34 +00:00
Kernel: Switch Region to IntrusiveList from InlineLinkedList
This commit is contained in:
parent
e0da61f9d6
commit
e6f73d69a2
3 changed files with 12 additions and 13 deletions
|
@ -855,18 +855,18 @@ void MemoryManager::register_region(Region& region)
|
||||||
{
|
{
|
||||||
ScopedSpinLock lock(s_mm_lock);
|
ScopedSpinLock lock(s_mm_lock);
|
||||||
if (region.is_kernel())
|
if (region.is_kernel())
|
||||||
m_kernel_regions.append(®ion);
|
m_kernel_regions.append(region);
|
||||||
else
|
else
|
||||||
m_user_regions.append(®ion);
|
m_user_regions.append(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryManager::unregister_region(Region& region)
|
void MemoryManager::unregister_region(Region& region)
|
||||||
{
|
{
|
||||||
ScopedSpinLock lock(s_mm_lock);
|
ScopedSpinLock lock(s_mm_lock);
|
||||||
if (region.is_kernel())
|
if (region.is_kernel())
|
||||||
m_kernel_regions.remove(®ion);
|
m_kernel_regions.remove(region);
|
||||||
else
|
else
|
||||||
m_user_regions.remove(®ion);
|
m_user_regions.remove(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryManager::dump_kernel_regions()
|
void MemoryManager::dump_kernel_regions()
|
||||||
|
|
|
@ -233,8 +233,8 @@ private:
|
||||||
NonnullRefPtrVector<PhysicalRegion> m_user_physical_regions;
|
NonnullRefPtrVector<PhysicalRegion> m_user_physical_regions;
|
||||||
NonnullRefPtrVector<PhysicalRegion> m_super_physical_regions;
|
NonnullRefPtrVector<PhysicalRegion> m_super_physical_regions;
|
||||||
|
|
||||||
InlineLinkedList<Region> m_user_regions;
|
Region::List m_user_regions;
|
||||||
InlineLinkedList<Region> m_kernel_regions;
|
Region::List m_kernel_regions;
|
||||||
Vector<UsedMemoryRange> m_used_memory_ranges;
|
Vector<UsedMemoryRange> m_used_memory_ranges;
|
||||||
Vector<PhysicalMemoryRange> m_physical_memory_ranges;
|
Vector<PhysicalMemoryRange> m_physical_memory_ranges;
|
||||||
Vector<ContiguousReservedMemoryRange> m_reserved_memory_ranges;
|
Vector<ContiguousReservedMemoryRange> m_reserved_memory_ranges;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/EnumBits.h>
|
#include <AK/EnumBits.h>
|
||||||
#include <AK/InlineLinkedList.h>
|
#include <AK/IntrusiveList.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/WeakPtr.h>
|
#include <AK/WeakPtr.h>
|
||||||
#include <AK/Weakable.h>
|
#include <AK/Weakable.h>
|
||||||
|
@ -29,8 +29,7 @@ enum class ShouldFlushTLB {
|
||||||
};
|
};
|
||||||
|
|
||||||
class Region final
|
class Region final
|
||||||
: public InlineLinkedListNode<Region>
|
: public Weakable<Region>
|
||||||
, public Weakable<Region>
|
|
||||||
, public PurgeablePageRanges {
|
, public PurgeablePageRanges {
|
||||||
friend class MemoryManager;
|
friend class MemoryManager;
|
||||||
|
|
||||||
|
@ -211,10 +210,6 @@ public:
|
||||||
|
|
||||||
void remap();
|
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 remap_vmobject_page_range(size_t page_index, size_t page_count);
|
||||||
|
|
||||||
bool is_volatile(VirtualAddress vaddr, size_t size) const;
|
bool is_volatile(VirtualAddress vaddr, size_t size) const;
|
||||||
|
@ -267,6 +262,10 @@ private:
|
||||||
bool m_mmap : 1 { false };
|
bool m_mmap : 1 { false };
|
||||||
bool m_syscall_region : 1 { false };
|
bool m_syscall_region : 1 { false };
|
||||||
WeakPtr<Process> m_owner;
|
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)
|
AK_ENUM_BITWISE_OPERATORS(Region::Access)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue