Module Name:    src
Committed By:   matt
Date:           Fri Mar 14 22:34:35 UTC 2014

Modified Files:
        src/sys/kern [matt-nb5-mips64]: kern_malloc.c

Log Message:
Deal with the issue that VM_MAP_INTRSAFE km_suballoc returns more than asked
for so the space needs for kmemusage accounting has to needs adjusted as well.


To generate a diff of this commit:
cvs rdiff -u -r1.121.10.2 -r1.121.10.3 src/sys/kern/kern_malloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_malloc.c
diff -u src/sys/kern/kern_malloc.c:1.121.10.2 src/sys/kern/kern_malloc.c:1.121.10.3
--- src/sys/kern/kern_malloc.c:1.121.10.2	Fri Mar 14 21:45:41 2014
+++ src/sys/kern/kern_malloc.c	Fri Mar 14 22:34:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_malloc.c,v 1.121.10.2 2014/03/14 21:45:41 matt Exp $	*/
+/*	$NetBSD: kern_malloc.c,v 1.121.10.3 2014/03/14 22:34:35 matt Exp $	*/
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.121.10.2 2014/03/14 21:45:41 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.121.10.3 2014/03/14 22:34:35 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -926,7 +926,12 @@ kmeminit(void)
 	kmembase = (char *)kmb;
 	kmemlimit = (char *)kml;
 
-	KASSERT(((kmemlimit - kmembase) >> PAGE_SHIFT) == nkmempages);
+	/*
+	 * Since the suballoc was VM_MAP_INTRSAFE, the allocated size
+	 * may be larger than was we asked for.  Recompute nkmempages
+	 * to cover the additional space allocated.  
+	 */
+	nkmempages = (kmemlimit - kmembase) >> PAGE_SHIFT;
 
 	kmemusage = (struct kmemusage *) uvm_km_alloc(kernel_map,
 	    (vsize_t)(nkmempages * sizeof(struct kmemusage)), 0,

Reply via email to