kern_malloc.c (76166) | kern_malloc.c (77843) |
---|---|
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 * $FreeBSD: head/sys/kern/kern_malloc.c 76166 2001-05-01 08:13:21Z markm $ | 34 * $FreeBSD: head/sys/kern/kern_malloc.c 77843 2001-06-06 22:17:08Z peter $ |
35 */ 36 37#include "opt_vm.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/lock.h> --- 376 unchanged lines hidden (view full) --- 419/* ARGSUSED*/ 420static void 421kmeminit(dummy) 422 void *dummy; 423{ 424 register long indx; 425 u_long npg; 426 u_long mem_size; | 35 */ 36 37#include "opt_vm.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/lock.h> --- 376 unchanged lines hidden (view full) --- 419/* ARGSUSED*/ 420static void 421kmeminit(dummy) 422 void *dummy; 423{ 424 register long indx; 425 u_long npg; 426 u_long mem_size; |
427 u_long xvm_kmem_size; | |
428 429#if ((MAXALLOCSAVE & (MAXALLOCSAVE - 1)) != 0) 430#error "kmeminit: MAXALLOCSAVE not power of 2" 431#endif 432#if (MAXALLOCSAVE > MINALLOCSIZE * 32768) 433#error "kmeminit: MAXALLOCSAVE too big" 434#endif 435#if (MAXALLOCSAVE < PAGE_SIZE) --- 9 unchanged lines hidden (view full) --- 445 * a VM_KMEM_SIZE of 12MB is a fair compromise. The 446 * VM_KMEM_SIZE_MAX is dependent on the maximum KVA space 447 * available, and on an X86 with a total KVA space of 256MB, 448 * try to keep VM_KMEM_SIZE_MAX at 80MB or below. 449 * 450 * Note that the kmem_map is also used by the zone allocator, 451 * so make sure that there is enough space. 452 */ | 427 428#if ((MAXALLOCSAVE & (MAXALLOCSAVE - 1)) != 0) 429#error "kmeminit: MAXALLOCSAVE not power of 2" 430#endif 431#if (MAXALLOCSAVE > MINALLOCSIZE * 32768) 432#error "kmeminit: MAXALLOCSAVE too big" 433#endif 434#if (MAXALLOCSAVE < PAGE_SIZE) --- 9 unchanged lines hidden (view full) --- 444 * a VM_KMEM_SIZE of 12MB is a fair compromise. The 445 * VM_KMEM_SIZE_MAX is dependent on the maximum KVA space 446 * available, and on an X86 with a total KVA space of 256MB, 447 * try to keep VM_KMEM_SIZE_MAX at 80MB or below. 448 * 449 * Note that the kmem_map is also used by the zone allocator, 450 * so make sure that there is enough space. 451 */ |
453 xvm_kmem_size = VM_KMEM_SIZE; | 452 vm_kmem_size = VM_KMEM_SIZE; |
454 mem_size = cnt.v_page_count * PAGE_SIZE; 455 456#if defined(VM_KMEM_SIZE_SCALE) | 453 mem_size = cnt.v_page_count * PAGE_SIZE; 454 455#if defined(VM_KMEM_SIZE_SCALE) |
457 if ((mem_size / VM_KMEM_SIZE_SCALE) > xvm_kmem_size) 458 xvm_kmem_size = mem_size / VM_KMEM_SIZE_SCALE; | 456 if ((mem_size / VM_KMEM_SIZE_SCALE) > vm_kmem_size) 457 vm_kmem_size = mem_size / VM_KMEM_SIZE_SCALE; |
459#endif 460 461#if defined(VM_KMEM_SIZE_MAX) | 458#endif 459 460#if defined(VM_KMEM_SIZE_MAX) |
462 if (xvm_kmem_size >= VM_KMEM_SIZE_MAX) 463 xvm_kmem_size = VM_KMEM_SIZE_MAX; | 461 if (vm_kmem_size >= VM_KMEM_SIZE_MAX) 462 vm_kmem_size = VM_KMEM_SIZE_MAX; |
464#endif 465 466 /* Allow final override from the kernel environment */ | 463#endif 464 465 /* Allow final override from the kernel environment */ |
467 TUNABLE_INT_FETCH("kern.vm.kmem.size", xvm_kmem_size, vm_kmem_size); | 466 TUNABLE_INT_FETCH("kern.vm.kmem.size", &vm_kmem_size); |
468 469 /* 470 * Limit kmem virtual size to twice the physical memory. 471 * This allows for kmem map sparseness, but limits the size 472 * to something sane. Be careful to not overflow the 32bit 473 * ints while doing the check. 474 */ 475 if ((vm_kmem_size / 2) > (cnt.v_page_count * PAGE_SIZE)) --- 98 unchanged lines hidden --- | 467 468 /* 469 * Limit kmem virtual size to twice the physical memory. 470 * This allows for kmem map sparseness, but limits the size 471 * to something sane. Be careful to not overflow the 32bit 472 * ints while doing the check. 473 */ 474 if ((vm_kmem_size / 2) > (cnt.v_page_count * PAGE_SIZE)) --- 98 unchanged lines hidden --- |