Date: Mon, 20 May 1996 19:43:45 -0700 From: David Greenman <davidg@Root.COM> To: Joe McGuckin <joe@ns.via.net> Cc: hackers@FreeBSD.org, questions@FreeBSD.org Subject: Re: Help - Panic Attacks! Message-ID: <199605210243.TAA11579@Root.COM> In-Reply-To: Your message of "Mon, 20 May 1996 14:33:41 PDT." <199605202133.OAA21060@ns.via.net>
next in thread | previous in thread | raw e-mail | index | archive | help
>Our web machine (FreeBSD 2.1, 128Meg) panicked today - twice in a row. > >Can anyone shed some light on this? >May 19 02:03:56 ovation /kernel: panic: kmem_malloc: kmem_map too small This is caused by a bug in the calculation of the size of the malloc area, causing the system to calculate it far too small when a large NMBCLUSTERS value is used. The attached patch fixes this problem. -DG David Greenman Core-team/Principal Architect, The FreeBSD Project Index: kern_malloc.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_malloc.c,v retrieving revision 1.12 retrieving revision 1.12.4.1 diff -c -r1.12 -r1.12.4.1 *** kern_malloc.c 1995/05/30 08:05:33 1.12 --- kern_malloc.c 1996/01/29 11:20:25 1.12.4.1 *************** *** 31,37 **** * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 ! * $Id: kern_malloc.c,v 1.12 1995/05/30 08:05:33 rgrimes Exp $ */ #include <sys/param.h> --- 31,37 ---- * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 ! * $Id: kern_malloc.c,v 1.12.4.1 1996/01/29 11:20:25 davidg Exp $ */ #include <sys/param.h> *************** *** 39,44 **** --- 39,45 ---- #include <sys/proc.h> #include <sys/kernel.h> #include <sys/malloc.h> + #include <sys/mbuf.h> #include <vm/vm.h> #include <vm/vm_kern.h> *************** *** 371,384 **** #if (MAXALLOCSAVE < CLBYTES) ERROR!_kmeminit:_MAXALLOCSAVE_too_small #endif ! npg = VM_KMEM_SIZE/ NBPG; ! if( npg > cnt.v_page_count) ! npg = cnt.v_page_count; kmemusage = (struct kmemusage *) kmem_alloc(kernel_map, (vm_size_t)(npg * sizeof(struct kmemusage))); kmem_map = kmem_suballoc(kernel_map, (vm_offset_t *)&kmembase, ! (vm_offset_t *)&kmemlimit, (vm_size_t)(npg * NBPG), FALSE); #ifdef KMEMSTATS for (indx = 0; indx < MINBUCKET + 16; indx++) { if (1 << indx >= CLBYTES) --- 372,384 ---- #if (MAXALLOCSAVE < CLBYTES) ERROR!_kmeminit:_MAXALLOCSAVE_too_small #endif ! npg = (nmbclusters * MCLBYTES + VM_KMEM_SIZE) / PAGE_SIZE; kmemusage = (struct kmemusage *) kmem_alloc(kernel_map, (vm_size_t)(npg * sizeof(struct kmemusage))); kmem_map = kmem_suballoc(kernel_map, (vm_offset_t *)&kmembase, ! (vm_offset_t *)&kmemlimit, (vm_size_t)(npg * PAGE_SIZE), ! FALSE); #ifdef KMEMSTATS for (indx = 0; indx < MINBUCKET + 16; indx++) { if (1 << indx >= CLBYTES) *************** *** 387,393 **** bucket[indx].kb_elmpercl = CLBYTES / (1 << indx); bucket[indx].kb_highwat = 5 * bucket[indx].kb_elmpercl; } ! for (indx = 0; indx < M_LAST; indx++) ! kmemstats[indx].ks_limit = npg * NBPG * 6 / 10; #endif } --- 387,399 ---- bucket[indx].kb_elmpercl = CLBYTES / (1 << indx); bucket[indx].kb_highwat = 5 * bucket[indx].kb_elmpercl; } ! /* ! * Limit maximum memory for each type to 60% of malloc area size or ! * 60% of physical memory, whichever is smaller. ! */ ! for (indx = 0; indx < M_LAST; indx++) { ! kmemstats[indx].ks_limit = min(cnt.v_page_count * PAGE_SIZE, ! (npg * PAGE_SIZE - nmbclusters * MCLBYTES)) * 6 / 10; ! } #endif }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605210243.TAA11579>