Module Name: src
Committed By: christos
Date: Sat Oct 15 21:14:57 UTC 2011
Modified Files:
src/sys/kern: kern_malloc.c
src/sys/sys: mallocvar.h
Log Message:
make buckets u_int. Fixes diagnostic panic when we allocate more than 65K
active elements in a bucket.
To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/kern/kern_malloc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/mallocvar.h
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.132 src/sys/kern/kern_malloc.c:1.133
--- src/sys/kern/kern_malloc.c:1.132 Wed Aug 31 14:31:02 2011
+++ src/sys/kern/kern_malloc.c Sat Oct 15 17:14:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_malloc.c,v 1.132 2011/08/31 18:31:02 plunky Exp $ */
+/* $NetBSD: kern_malloc.c,v 1.133 2011/10/15 21:14:57 christos Exp $ */
/*
* Copyright (c) 1987, 1991, 1993
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.132 2011/08/31 18:31:02 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.133 2011/10/15 21:14:57 christos Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -372,7 +372,7 @@ kern_malloc(unsigned long size, struct m
}
ksp->ks_size |= 1 << indx;
#ifdef DIAGNOSTIC
- if (ksp->ks_active[indx - MINBUCKET] == USHRT_MAX)
+ if (ksp->ks_active[indx - MINBUCKET] == UINT_MAX)
panic("too many allocations in bucket");
#endif
ksp->ks_active[indx - MINBUCKET]++;
Index: src/sys/sys/mallocvar.h
diff -u src/sys/sys/mallocvar.h:1.9 src/sys/sys/mallocvar.h:1.10
--- src/sys/sys/mallocvar.h:1.9 Mon Apr 5 04:03:41 2010
+++ src/sys/sys/mallocvar.h Sat Oct 15 17:14:57 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mallocvar.h,v 1.9 2010/04/05 08:03:41 he Exp $ */
+/* $NetBSD: mallocvar.h,v 1.10 2011/10/15 21:14:57 christos Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -57,7 +57,7 @@ struct malloc_type {
u_long ks_maxused; /* maximum number ever used */
u_long ks_limit; /* most that are allowed to exist */
u_long ks_size; /* sizes of this thing that are allocated */
- u_short ks_active[MAXBUCKET+1]; /* number of active allocations per size */
+ u_int ks_active[MAXBUCKET+1]; /* number of active allocations per size */
};
#ifdef _KERNEL