summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-04 22:55:16 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-05 17:41:58 +0200
commit067216384094dccb47a6900c8414f22e11c13831 (patch)
tree762ffdb0c2e96426542e7c589f7480204bcc5aec /Kernel
parentfa627c1eb2d34be4765e37af3bb8684d33c4524b (diff)
downloadserenity-067216384094dccb47a6900c8414f22e11c13831.zip
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.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/VM/AnonymousVMObject.cpp10
1 files changed, 2 insertions, 8 deletions
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<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()