kern_malloc.c (31549) | kern_malloc.c (32702) |
---|---|
1/* 2 * Copyright (c) 1987, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 | 1/* 2 * Copyright (c) 1987, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 |
34 * $Id: kern_malloc.c,v 1.37 1997/10/28 19:00:53 phk Exp $ | 34 * $Id: kern_malloc.c,v 1.38 1997/12/05 05:36:36 dyson Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/kernel.h> 40#define MALLOC_INSTANTIATE 41#include <sys/malloc.h> 42#include <sys/mbuf.h> --- 339 unchanged lines hidden (view full) --- 382#error "kmeminit: MAXALLOCSAVE too small" 383#endif 384 npg = (nmbufs * MSIZE + nmbclusters * MCLBYTES + VM_KMEM_SIZE) 385 / PAGE_SIZE; 386 387 kmemusage = (struct kmemusage *) kmem_alloc(kernel_map, 388 (vm_size_t)(npg * sizeof(struct kmemusage))); 389 kmem_map = kmem_suballoc(kernel_map, (vm_offset_t *)&kmembase, | 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/kernel.h> 40#define MALLOC_INSTANTIATE 41#include <sys/malloc.h> 42#include <sys/mbuf.h> --- 339 unchanged lines hidden (view full) --- 382#error "kmeminit: MAXALLOCSAVE too small" 383#endif 384 npg = (nmbufs * MSIZE + nmbclusters * MCLBYTES + VM_KMEM_SIZE) 385 / PAGE_SIZE; 386 387 kmemusage = (struct kmemusage *) kmem_alloc(kernel_map, 388 (vm_size_t)(npg * sizeof(struct kmemusage))); 389 kmem_map = kmem_suballoc(kernel_map, (vm_offset_t *)&kmembase, |
390 (vm_offset_t *)&kmemlimit, (vm_size_t)(npg * PAGE_SIZE), 391 FALSE); | 390 (vm_offset_t *)&kmemlimit, (vm_size_t)(npg * PAGE_SIZE)); |
392 kmem_map->system_map = 1; 393 for (indx = 0; indx < MINBUCKET + 16; indx++) { 394 if (1 << indx >= PAGE_SIZE) 395 bucket[indx].kb_elmpercl = 1; 396 else 397 bucket[indx].kb_elmpercl = PAGE_SIZE / (1 << indx); 398 bucket[indx].kb_highwat = 5 * bucket[indx].kb_elmpercl; 399 } --- 27 unchanged lines hidden --- | 391 kmem_map->system_map = 1; 392 for (indx = 0; indx < MINBUCKET + 16; indx++) { 393 if (1 << indx >= PAGE_SIZE) 394 bucket[indx].kb_elmpercl = 1; 395 else 396 bucket[indx].kb_elmpercl = PAGE_SIZE / (1 << indx); 397 bucket[indx].kb_highwat = 5 * bucket[indx].kb_elmpercl; 398 } --- 27 unchanged lines hidden --- |