MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_thread_stack_dispose

Function vm_thread_stack_dispose

freebsd/vm/vm_glue.c:334–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334static void
335vm_thread_stack_dispose(vm_offset_t ks, int pages)
336{
337 vm_page_t m;
338 vm_pindex_t pindex;
339 int i;
340
341 pindex = atop(ks - VM_MIN_KERNEL_ADDRESS);
342
343 pmap_qremove(ks, pages);
344 VM_OBJECT_WLOCK(kstack_object);
345 for (i = 0; i < pages; i++) {
346 m = vm_page_lookup(kstack_object, pindex + i);
347 if (m == NULL)
348 panic("%s: kstack already missing?", __func__);
349 vm_page_xbusy_claim(m);
350 vm_page_unwire_noq(m);
351 vm_page_free(m);
352 }
353 VM_OBJECT_WUNLOCK(kstack_object);
354 kva_free(ks - (KSTACK_GUARD_PAGES * PAGE_SIZE),
355 (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE);
356}
357
358/*
359 * Allocate the kernel stack for a new thread.

Callers 2

vm_thread_disposeFunction · 0.85
kstack_releaseFunction · 0.85

Calls 6

vm_page_lookupFunction · 0.85
vm_page_unwire_noqFunction · 0.85
vm_page_freeFunction · 0.85
kva_freeFunction · 0.85
pmap_qremoveFunction · 0.50
panicFunction · 0.50

Tested by

no test coverage detected