git: 661a83f9bf9f - main - vm: Fix error handling in vm_thread_stack_back()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 30 Apr 2024 13:45:57 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=661a83f9bf9f6028c5617d413d59b7f0d9201abd
commit 661a83f9bf9f6028c5617d413d59b7f0d9201abd
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-04-29 16:22:36 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-04-30 13:45:48 +0000
vm: Fix error handling in vm_thread_stack_back()
vm_object_page_remove() wants to busy the page, but that won't work
here. (Kernel stack pages are always busy.)
Make the error handling path look more like vm_thread_stack_dispose().
Reported by: pho
Reviewed by: kib, bnovkov
Fixes: 7a79d0669761 ("vm: improve kstack_object pindex calculation to avoid pindex holes")
Differential Revision: https://reviews.freebsd.org/D45019
---
sys/vm/vm_glue.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index f9235fe03fab..979a0fc27120 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -630,7 +630,11 @@ vm_thread_stack_back(vm_offset_t ks, vm_page_t ma[], int npages, int req_class,
return (0);
cleanup:
- vm_object_page_remove(obj, pindex, pindex + n, 0);
+ for (int i = 0; i < n; i++) {
+ m = ma[i];
+ (void)vm_page_unwire_noq(m);
+ vm_page_free(m);
+ }
VM_OBJECT_WUNLOCK(obj);
return (ENOMEM);