From ab807f32085e5861bf3d3336c9de2c0d1e977b4c Mon Sep 17 00:00:00 2001 From: Etienne Brateau Date: Mon, 2 Dec 2024 19:27:17 +0100 Subject: vm_page.c: fix a deadlock when running with smp enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the call vm_page_seg_pull_cache_page() return an vm_page (src) with his object being locked, as we don’t unlock before doing the vm_page_insert, it is still lock there, and so trying to relock it cause a deadlock. Replace this lock by an assert. This case was not seen as for non-smp locking is a no-op. Message-ID: <20241202182721.27920-2-etienne.brateau@gmail.com> --- vm/vm_page.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vm/vm_page.c b/vm/vm_page.c index 286fe62f..b0d3b7c2 100644 --- a/vm/vm_page.c +++ b/vm/vm_page.c @@ -1036,7 +1036,8 @@ vm_page_seg_balance_page(struct vm_page_seg *seg, simple_unlock(&seg->lock); simple_unlock(&vm_page_queue_free_lock); - vm_object_lock(object); + // object is already locked as vm_page_seg_alloc_from_buddy return it locked + assert(vm_object_lock_taken(object) != 0); vm_page_insert(dest, object, offset); vm_object_unlock(object); -- cgit v1.2.3