Date: Tue, 21 May 2002 10:43:40 -0700 (PDT) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 11669 for review Message-ID: <200205211743.g4LHhe017780@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=11669 Change 11669 by jhb@jhb_laptop on 2002/05/21 10:42:54 IFC commits from yesterday. Affected files ... ... //depot/projects/smpng/sys/kern/kern_malloc.c#12 integrate ... //depot/projects/smpng/sys/kern/subr_witness.c#50 integrate ... //depot/projects/smpng/sys/vm/uma_core.c#14 integrate Differences ... ==== //depot/projects/smpng/sys/kern/kern_malloc.c#12 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 - * $FreeBSD: src/sys/kern/kern_malloc.c,v 1.108 2002/05/02 09:07:03 jeff Exp $ + * $FreeBSD: src/sys/kern/kern_malloc.c,v 1.110 2002/05/20 18:29:37 jake Exp $ */ #include "opt_vm.h" @@ -157,11 +157,9 @@ if (size == 0) Debugger("zero size malloc"); #endif -#if defined(INVARIANTS) - if (flags == M_WAITOK) + if (!(flags & M_NOWAIT)) KASSERT(curthread->td_intr_nesting_level == 0, ("malloc(M_WAITOK) in interrupt context")); -#endif if (size <= KMEM_ZMAX) { if (size & KMEM_ZMASK) size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; @@ -526,7 +524,7 @@ p += len; first = 1; - for (i = 0; i < 8 * sizeof(type->ks_size); i++) + for (i = 0; i < 32 /* 8 * sizeof(type->ks_size) */; i++) if (type->ks_size & (1 << i)) { if (first) len = snprintf(p, curline, " "); ==== //depot/projects/smpng/sys/kern/subr_witness.c#50 (text+ko) ==== @@ -27,7 +27,7 @@ * * from BSDI $Id: mutex_witness.c,v 1.1.2.20 2000/04/27 03:10:27 cp Exp $ * and BSDI $Id: synch_machdep.c,v 2.3.2.39 2000/04/27 03:10:25 cp Exp $ - * $FreeBSD: src/sys/kern/subr_witness.c,v 1.114 2002/05/06 19:31:28 alfred Exp $ + * $FreeBSD: src/sys/kern/subr_witness.c,v 1.116 2002/05/20 19:16:22 jhb Exp $ */ /* @@ -878,14 +878,9 @@ struct thread *td; int i, n; - if (witness_dead || panicstr != NULL) + if (witness_cold || witness_dead || panicstr != NULL) return (0); - KASSERT(!witness_cold, ("%s: witness_cold", __func__)); n = 0; - /* - * Preemption bad because we need PCPU_PTR(spinlocks) to not change. - */ - critical_enter(); td = curthread; lock_list = &td->td_sleeplocks; again: @@ -912,7 +907,11 @@ lock1->li_lock->lo_name, lock1->li_file, lock1->li_line); } - if (lock_list == &td->td_sleeplocks) { + if (lock_list == &td->td_sleeplocks && PCPU_GET(spinlocks) != NULL) { + /* + * Since we already hold a spinlock preemption is + * already blocked. + */ lock_list = PCPU_PTR(spinlocks); goto again; } @@ -920,7 +919,6 @@ if (witness_ddb && n) Debugger(__func__); #endif /* DDB */ - critical_exit(); return (n); } @@ -1346,15 +1344,9 @@ * out from under us. It is probably best to just not try to handle * threads on other CPU's for now. */ - if (td == curthread) { - /* - * Preemption bad because we need PCPU_PTR(spinlocks) to not - * change. - */ - critical_enter(); + if (td == curthread && PCPU_GET(spinlocks) != NULL) nheld += witness_list_locks(PCPU_PTR(spinlocks)); - critical_exit(); - } + return (nheld); } ==== //depot/projects/smpng/sys/vm/uma_core.c#14 (text+ko) ==== @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/vm/uma_core.c,v 1.24 2002/05/13 05:08:18 jeff Exp $ + * $FreeBSD: src/sys/vm/uma_core.c,v 1.25 2002/05/20 17:54:48 jhb Exp $ * */ @@ -66,6 +66,7 @@ #include <sys/lock.h> #include <sys/sysctl.h> #include <sys/mutex.h> +#include <sys/proc.h> #include <sys/smp.h> #include <sys/vmmeter.h> @@ -1317,6 +1318,12 @@ printf("Allocating one item from %s(%p)\n", zone->uz_name, zone); #endif + if (!(flags & M_NOWAIT)) { + KASSERT(curthread->td_intr_nesting_level == 0, + ("malloc(M_WAITOK) in interrupt context")); + WITNESS_SLEEP(1, NULL); + } + zalloc_restart: cpu = PCPU_GET(cpuid); CPU_LOCK(zone, cpu); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205211743.g4LHhe017780>