> 
> Since going from a SMP to nonSMP kernel the Hard Locks don't
> seem to be happening.  However I'm getting panics.
> 
> I've gotten 4 'sleeping thread owns a mutex' panics and one each
> of 'Assertion i != 0 failed at ../../../kern/subr_witness.c:669'
> and 'Duplicate free of item 0xc3895cc0 from zone 0xc0ea63c0(VMSPACE)'

The 'Duplicate free' can be caused by a race between swapout_procs()
and kern_exit()+wait1().

The enclosed patch might help.

Disabling swapping (sysctl vm.swap_enabled=0) can also help.

- Tor Egge
Index: sys/kern/kern_exit.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_exit.c,v
retrieving revision 1.184
diff -u -r1.184 kern_exit.c
--- sys/kern/kern_exit.c        15 Oct 2002 00:14:32 -0000      1.184
+++ sys/kern/kern_exit.c        10 Nov 2002 17:58:39 -0000
@@ -285,7 +285,7 @@
         * Can't free the entire vmspace as the kernel stack
         * may be mapped within that space also.
         */
-       if (--vm->vm_refcnt == 0) {
+       if (vm->vm_refcnt == 1) {
                if (vm->vm_shm)
                        shmexit(p);
                pmap_remove_pages(vmspace_pmap(vm), vm_map_min(&vm->vm_map),
Index: sys/vm/vm_map.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_map.c,v
retrieving revision 1.271
diff -u -r1.271 vm_map.c
--- sys/vm/vm_map.c     9 Nov 2002 21:26:49 -0000       1.271
+++ sys/vm/vm_map.c     10 Nov 2002 17:59:40 -0000
@@ -314,11 +317,9 @@
        struct vmspace *vm;
 
        GIANT_REQUIRED;
-       if (p == p->p_vmspace->vm_freer) {
-               vm = p->p_vmspace;
-               p->p_vmspace = NULL;
-               vmspace_dofree(vm);
-       }
+       vm = p->p_vmspace;
+       p->p_vmspace = NULL;
+       vmspace_free(vm);
 }
 
 /*

Reply via email to