diff options
author | julian <julian@FreeBSD.org> | 2002-12-10 02:33:45 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2002-12-10 02:33:45 +0000 |
commit | 9868d96f1fab28e828ad309a400539d072e1da2d (patch) | |
tree | b7b4d7891168c36af86fd5540478865532fe8977 /sys/i386 | |
parent | 9349f701144f7b1af93f420305e9cbf99727d7ed (diff) | |
download | FreeBSD-src-9868d96f1fab28e828ad309a400539d072e1da2d.zip FreeBSD-src-9868d96f1fab28e828ad309a400539d072e1da2d.tar.gz |
Unbreak the KSE code. Keep track of zobie threads using the Per-CPU storage
during the context switch. Rearrange thread cleanups
to avoid problems with Giant. Clean threads when freed or
when recycled.
Approved by: re (jhb)
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/vm_machdep.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 1f1e400..4f1734a 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -282,7 +282,7 @@ cpu_thread_exit(struct thread *td) } void -cpu_thread_dtor(struct thread *td) +cpu_thread_clean(struct thread *td) { struct pcb *pcb; @@ -294,8 +294,10 @@ cpu_thread_dtor(struct thread *td) * XXX do we need to move the TSS off the allocated pages * before freeing them? (not done here) */ + mtx_lock(&Giant); kmem_free(kernel_map, (vm_offset_t)pcb->pcb_ext, ctob(IOPAGES + 1)); + mtx_unlock(&Giant); pcb->pcb_ext = 0; } } @@ -388,6 +390,15 @@ void cpu_set_upcall_kse(struct thread *td, struct kse *ke) { + /* + * Do any extra cleaning that needs to be done. + * The thread may have optional components + * that are not present in a fresh thread. + * This may be a recycled thread so make it look + * as though it's newly allocated. + */ + cpu_thread_clean(td); + /* * Set the trap frame to point at the beginning of the uts * function. |