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

Kernel: Simplify AnonymousVMObject copy constructor

It was doing a bunch of things it didn't need to do. I think we had
misunderstood the base class as having copied m_lock in its copy
constructor but it's actually default initialized.
This commit is contained in:
Andreas Kling 2021-08-04 22:55:16 +02:00
parent fa627c1eb2
commit 0672163840

View file

@ -155,16 +155,10 @@ AnonymousVMObject::AnonymousVMObject(Span<NonnullRefPtr<PhysicalPage>> physical_
AnonymousVMObject::AnonymousVMObject(AnonymousVMObject const& other) AnonymousVMObject::AnonymousVMObject(AnonymousVMObject const& other)
: VMObject(other) : VMObject(other)
, m_cow_map() // do *not* clone this , m_shared_committed_cow_pages(other.m_shared_committed_cow_pages)
, m_shared_committed_cow_pages(other.m_shared_committed_cow_pages) // share the pool
, m_purgeable(other.m_purgeable) , m_purgeable(other.m_purgeable)
{ {
// We can't really "copy" a spinlock. But we're holding it. Clear in the clone ensure_cow_map();
VERIFY(other.m_lock.is_locked());
m_lock.initialize();
// The clone also becomes COW
ensure_or_reset_cow_map();
} }
AnonymousVMObject::~AnonymousVMObject() AnonymousVMObject::~AnonymousVMObject()