From 067216384094dccb47a6900c8414f22e11c13831 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 4 Aug 2021 22:55:16 +0200 Subject: 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. --- Kernel/VM/AnonymousVMObject.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'Kernel') diff --git a/Kernel/VM/AnonymousVMObject.cpp b/Kernel/VM/AnonymousVMObject.cpp index c0e2f52d81..7ea5c8c33f 100644 --- a/Kernel/VM/AnonymousVMObject.cpp +++ b/Kernel/VM/AnonymousVMObject.cpp @@ -155,16 +155,10 @@ AnonymousVMObject::AnonymousVMObject(Span> 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() -- cgit v1.2.3