1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +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)
: VMObject(other)
, m_cow_map() // do *not* clone this
, m_shared_committed_cow_pages(other.m_shared_committed_cow_pages) // share the pool
, m_shared_committed_cow_pages(other.m_shared_committed_cow_pages)
, m_purgeable(other.m_purgeable)
{
// We can't really "copy" a spinlock. But we're holding it. Clear in the clone
VERIFY(other.m_lock.is_locked());
m_lock.initialize();
// The clone also becomes COW
ensure_or_reset_cow_map();
ensure_cow_map();
}
AnonymousVMObject::~AnonymousVMObject()