Deleted Added
sdiff udiff text old ( 92511 ) new ( 92654 )
full compact
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. 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

--- 47 unchanged lines hidden (view full) ---

56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
57 * School of Computer Science
58 * Carnegie Mellon University
59 * Pittsburgh PA 15213-3890
60 *
61 * any improvements or extensions that they make and grant Carnegie the
62 * rights to redistribute these changes.
63 *
64 * $FreeBSD: head/sys/vm/vm_object.c 92511 2002-03-17 18:37:37Z alc $
65 */
66
67/*
68 * Virtual memory object module.
69 */
70
71#include <sys/param.h>
72#include <sys/systm.h>

--- 69 unchanged lines hidden (view full) ---

142vm_object_t kmem_object;
143static struct vm_object kernel_object_store;
144static struct vm_object kmem_object_store;
145extern int vm_pageout_page_count;
146
147static long object_collapses;
148static long object_bypasses;
149static int next_index;
150static vm_zone_t obj_zone;
151static struct vm_zone obj_zone_store;
152static int object_hash_rand;
153#define VM_OBJECTS_INIT 256
154static struct vm_object vm_objects_init[VM_OBJECTS_INIT];
155
156void
157_vm_object_allocate(objtype_t type, vm_size_t size, vm_object_t object)
158{
159 int incr;
160
161 GIANT_REQUIRED;
162
163 TAILQ_INIT(&object->memq);
164 TAILQ_INIT(&object->shadow_head);
165
166 object->type = type;
167 object->size = size;
168 object->ref_count = 1;
169 object->flags = 0;
170 if ((object->type == OBJT_DEFAULT) || (object->type == OBJT_SWAP))
171 vm_object_set_flag(object, OBJ_ONEMAPPING);
172 object->paging_in_progress = 0;
173 object->resident_page_count = 0;
174 object->shadow_count = 0;
175 object->pg_color = next_index;
176 if (size > (PQ_L2_SIZE / 3 + PQ_PRIME1))
177 incr = PQ_L2_SIZE / 3 + PQ_PRIME1;
178 else
179 incr = size;
180 next_index = (next_index + incr) & PQ_L2_MASK;
181 object->handle = NULL;
182 object->backing_object = NULL;

--- 28 unchanged lines hidden (view full) ---

211
212 kernel_object = &kernel_object_store;
213 _vm_object_allocate(OBJT_DEFAULT, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS),
214 kernel_object);
215
216 kmem_object = &kmem_object_store;
217 _vm_object_allocate(OBJT_DEFAULT, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS),
218 kmem_object);
219
220 obj_zone = &obj_zone_store;
221 zbootinit(obj_zone, "VM OBJECT", sizeof (struct vm_object),
222 vm_objects_init, VM_OBJECTS_INIT);
223}
224
225void
226vm_object_init2(void)
227{
228 zinitna(obj_zone, NULL, NULL, 0, 0, 0, 1);
229}
230
231void
232vm_object_set_flag(vm_object_t object, u_short bits)
233{
234 GIANT_REQUIRED;
235 object->flags |= bits;
236}

--- 1764 unchanged lines hidden ---