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
--- 49 unchanged lines hidden (view full) ---
58 * rights to redistribute these changes.
59 */
60
61/*
62 * Virtual memory object module.
63 */
64
65#include <sys/cdefs.h>
66__FBSDID("$FreeBSD: head/sys/vm/vm_object.c 247360 2013-02-26 23:35:27Z attilio $");
67
68#include "opt_vm.h"
69
70#include <sys/param.h>
71#include <sys/systm.h>
72#include <sys/lock.h>
73#include <sys/mman.h>
74#include <sys/mount.h>
--- 114 unchanged lines hidden (view full) ---
189
190static int
191vm_object_zinit(void *mem, int size, int flags)
192{
193 vm_object_t object;
194
195 object = (vm_object_t)mem;
196 bzero(&object->mtx, sizeof(object->mtx));
197 mtx_init(&object->mtx, "vm object", NULL, MTX_DEF | MTX_DUPOK);
198
199 /* These are true for any object that has been freed */
200 object->paging_in_progress = 0;
201 object->resident_page_count = 0;
202 object->shadow_count = 0;
203 return (0);
204}
205
206static void
207_vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object)
208{
209
210 TAILQ_INIT(&object->memq);
211 LIST_INIT(&object->shadow_head);
212
213 object->root = NULL;
214 object->type = type;
--- 46 unchanged lines hidden (view full) ---
261 * Initialize the VM objects module.
262 */
263void
264vm_object_init(void)
265{
266 TAILQ_INIT(&vm_object_list);
267 mtx_init(&vm_object_list_mtx, "vm object_list", NULL, MTX_DEF);
268
269 mtx_init(&kernel_object->mtx, "vm object", "kernel object", MTX_DEF);
270 _vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS),
271 kernel_object);
272#if VM_NRESERVLEVEL > 0
273 kernel_object->flags |= OBJ_COLORED;
274 kernel_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS);
275#endif
276
277 mtx_init(&kmem_object->mtx, "vm object", "kmem object", MTX_DEF);
278 _vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS),
279 kmem_object);
280#if VM_NRESERVLEVEL > 0
281 kmem_object->flags |= OBJ_COLORED;
282 kmem_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS);
283#endif
284
285 /*
--- 2111 unchanged lines hidden ---
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
--- 49 unchanged lines hidden (view full) ---
58 * rights to redistribute these changes.
59 */
60
61/*
62 * Virtual memory object module.
63 */
64
65#include <sys/cdefs.h>
66__FBSDID("$FreeBSD: head/sys/vm/vm_object.c 247360 2013-02-26 23:35:27Z attilio $");
67
68#include "opt_vm.h"
69
70#include <sys/param.h>
71#include <sys/systm.h>
72#include <sys/lock.h>
73#include <sys/mman.h>
74#include <sys/mount.h>
--- 114 unchanged lines hidden (view full) ---
189
190static int
191vm_object_zinit(void *mem, int size, int flags)
192{
193 vm_object_t object;
194
195 object = (vm_object_t)mem;
196 bzero(&object->mtx, sizeof(object->mtx));
197 mtx_init(&object->mtx, "vm object", NULL, MTX_DEF | MTX_DUPOK);
198
199 /* These are true for any object that has been freed */
200 object->paging_in_progress = 0;
201 object->resident_page_count = 0;
202 object->shadow_count = 0;
203 return (0);
204}
205
206static void
207_vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object)
208{
209
210 TAILQ_INIT(&object->memq);
211 LIST_INIT(&object->shadow_head);
212
213 object->root = NULL;
214 object->type = type;
--- 46 unchanged lines hidden (view full) ---
261 * Initialize the VM objects module.
262 */
263void
264vm_object_init(void)
265{
266 TAILQ_INIT(&vm_object_list);
267 mtx_init(&vm_object_list_mtx, "vm object_list", NULL, MTX_DEF);
268
269 mtx_init(&kernel_object->mtx, "vm object", "kernel object", MTX_DEF);
270 _vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS),
271 kernel_object);
272#if VM_NRESERVLEVEL > 0
273 kernel_object->flags |= OBJ_COLORED;
274 kernel_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS);
275#endif
276
277 mtx_init(&kmem_object->mtx, "vm object", "kmem object", MTX_DEF);
278 _vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS),
279 kmem_object);
280#if VM_NRESERVLEVEL > 0
281 kmem_object->flags |= OBJ_COLORED;
282 kmem_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS);
283#endif
284
285 /*
--- 2111 unchanged lines hidden ---