mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 19:25:07 +00:00
Kernel: Remove unnecessary counting of VMObject-attached Regions
VMObject already has an IntrusiveList of all the Regions that map it. We were keeping a counter in addition to this, and only using it in a single place to avoid iterating over the list in case it only had 1 entry. Simplify VMObject by removing this counter and always iterating the list even if there's only 1 entry. :^)
This commit is contained in:
parent
ae3778c303
commit
0d963fd641
3 changed files with 5 additions and 16 deletions
|
@ -52,19 +52,15 @@ public:
|
|||
ALWAYS_INLINE void add_region(Region& region)
|
||||
{
|
||||
ScopedSpinLock locker(m_lock);
|
||||
m_regions_count++;
|
||||
m_regions.append(region);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void remove_region(Region& region)
|
||||
{
|
||||
ScopedSpinLock locker(m_lock);
|
||||
m_regions_count--;
|
||||
m_regions.remove(region);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool is_shared_by_multiple_regions() const { return m_regions_count > 1; }
|
||||
|
||||
void register_on_deleted_handler(VMObjectDeletedHandler& handler)
|
||||
{
|
||||
ScopedSpinLock locker(m_on_deleted_lock);
|
||||
|
@ -93,7 +89,6 @@ private:
|
|||
VMObject& operator=(VMObject&&) = delete;
|
||||
VMObject(VMObject&&) = delete;
|
||||
|
||||
Atomic<u32, AK::MemoryOrder::memory_order_relaxed> m_regions_count { 0 };
|
||||
HashTable<VMObjectDeletedHandler*> m_on_deleted;
|
||||
SpinLock<u8> m_on_deleted_lock;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue