1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

Kernel: If a VMObject is shared, broadcast page remappings

If we remap pages (e.g. lazy allocation) inside a VMObject that is
shared among more than one region, broadcast it to any other region
that may be mapping the same page.
This commit is contained in:
Tom 2021-01-02 12:03:14 -07:00 committed by Andreas Kling
parent e3190bd144
commit c630669304
5 changed files with 117 additions and 18 deletions

View file

@ -67,6 +67,10 @@ public:
VMObject* m_next { nullptr };
VMObject* m_prev { nullptr };
ALWAYS_INLINE void ref_region() { m_regions_count.fetch_add(1, AK::MemoryOrder::memory_order_relaxed); }
ALWAYS_INLINE void unref_region() { m_regions_count.fetch_sub(1, AK::MemoryOrder::memory_order_relaxed); }
ALWAYS_INLINE bool is_shared_by_multiple_regions() const { return m_regions_count.load(AK::MemoryOrder::memory_order_relaxed) > 1; }
protected:
explicit VMObject(size_t);
explicit VMObject(const VMObject&);
@ -83,6 +87,8 @@ private:
VMObject& operator=(const VMObject&) = delete;
VMObject& operator=(VMObject&&) = delete;
VMObject(VMObject&&) = delete;
Atomic<u32> m_regions_count { 0 };
};
}