Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys make buckets u_int. Fixes diagnostic panic when we alloc...



details:   https://anonhg.NetBSD.org/src/rev/056b799caedd
branches:  trunk
changeset: 770403:056b799caedd
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 15 21:14:57 2011 +0000

description:
make buckets u_int. Fixes diagnostic panic when we allocate more than 65K
active elements in a bucket.

diffstat:

 sys/kern/kern_malloc.c |  6 +++---
 sys/sys/mallocvar.h    |  4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 3e8efc5df29c -r 056b799caedd sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c    Sat Oct 15 21:08:53 2011 +0000
+++ b/sys/kern/kern_malloc.c    Sat Oct 15 21:14:57 2011 +0000
@@ -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 @@
        }
        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]++;
diff -r 3e8efc5df29c -r 056b799caedd sys/sys/mallocvar.h
--- a/sys/sys/mallocvar.h       Sat Oct 15 21:08:53 2011 +0000
+++ b/sys/sys/mallocvar.h       Sat Oct 15 21:14:57 2011 +0000
@@ -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 @@
        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



Home | Main Index | Thread Index | Old Index