Skip to content

Commit 0672163

Browse files
committed
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.
1 parent fa627c1 commit 0672163

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Kernel/VM/AnonymousVMObject.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,10 @@ AnonymousVMObject::AnonymousVMObject(Span<NonnullRefPtr<PhysicalPage>> physical_
155155

156156
AnonymousVMObject::AnonymousVMObject(AnonymousVMObject const& other)
157157
: VMObject(other)
158-
, m_cow_map() // do *not* clone this
159-
, m_shared_committed_cow_pages(other.m_shared_committed_cow_pages) // share the pool
158+
, m_shared_committed_cow_pages(other.m_shared_committed_cow_pages)
160159
, m_purgeable(other.m_purgeable)
161160
{
162-
// We can't really "copy" a spinlock. But we're holding it. Clear in the clone
163-
VERIFY(other.m_lock.is_locked());
164-
m_lock.initialize();
165-
166-
// The clone also becomes COW
167-
ensure_or_reset_cow_map();
161+
ensure_cow_map();
168162
}
169163

170164
AnonymousVMObject::~AnonymousVMObject()

0 commit comments

Comments
 (0)