1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91 |
37 * $FreeBSD: head/sys/vm/vm_page.c 92654 2002-03-19 09:11:49Z jeff $ |
38 */ 39 40/* 41 * Copyright (c) 1987, 1990 Carnegie-Mellon University. 42 * All rights reserved. 43 * 44 * Authors: Avadis Tevanian, Jr., Michael Wayne Young 45 * --- 67 unchanged lines hidden (view full) --- 113#include <vm/vm.h> 114#include <vm/vm_param.h> 115#include <vm/vm_kern.h> 116#include <vm/vm_object.h> 117#include <vm/vm_page.h> 118#include <vm/vm_pageout.h> 119#include <vm/vm_pager.h> 120#include <vm/vm_extern.h> |
121#include <vm/uma.h> 122#include <vm/uma_int.h> |
123 124/* 125 * Associated with page of user-allocatable memory is a 126 * page structure. 127 */ 128static struct vm_page **vm_page_buckets; /* Array of buckets */ 129static int vm_page_bucket_count; /* How big is array? */ 130static int vm_page_hash_mask; /* Mask for hash function */ --- 42 unchanged lines hidden (view full) --- 173 int nblocks; 174 vm_offset_t last_pa; 175 176 /* the biggest memory array is the second group of pages */ 177 vm_offset_t end; 178 vm_offset_t biggestone, biggestsize; 179 180 vm_offset_t total; |
181 vm_size_t bootpages; |
182 183 total = 0; 184 biggestsize = 0; 185 biggestone = 0; 186 nblocks = 0; 187 vaddr = round_page(vaddr); 188 189 for (i = 0; phys_avail[i + 1]; i += 2) { --- 16 unchanged lines hidden (view full) --- 206 207 /* 208 * Initialize the queue headers for the free queue, the active queue 209 * and the inactive queue. 210 */ 211 vm_pageq_init(); 212 213 /* |
214 * Allocate memory for use when boot strapping the kernel memory allocator 215 */ 216 bootpages = UMA_BOOT_PAGES * UMA_SLAB_SIZE; 217 new_end = end - bootpages; 218 new_end = trunc_page(new_end); 219 mapped = pmap_map(&vaddr, new_end, end, 220 VM_PROT_READ | VM_PROT_WRITE); 221 bzero((caddr_t) mapped, end - new_end); 222 uma_startup((caddr_t)mapped); 223 224 end = new_end; 225 226 /* |
227 * Allocate (and initialize) the hash table buckets. 228 * 229 * The number of buckets MUST BE a power of 2, and the actual value is 230 * the next power of 2 greater than the number of physical pages in 231 * the system. 232 * 233 * We make the hash table approximately 2x the number of pages to 234 * reduce the chain length. This is about the same size using the --- 1559 unchanged lines hidden --- |