Deleted Added
full compact
vm_object.h (75523) vm_object.h (76827)
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 *
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.h 75523 2001-04-15 10:22:04Z alfred $
64 * $FreeBSD: head/sys/vm/vm_object.h 76827 2001-05-19 01:28:09Z alfred $
65 */
66
67/*
68 * Virtual memory object module definitions.
69 */
70
71#ifndef _VM_OBJECT_
72#define _VM_OBJECT_

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

164
165extern vm_object_t kernel_object; /* the single kernel object */
166extern vm_object_t kmem_object;
167
168#endif /* _KERNEL */
169
170#ifdef _KERNEL
171
65 */
66
67/*
68 * Virtual memory object module definitions.
69 */
70
71#ifndef _VM_OBJECT_
72#define _VM_OBJECT_

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

164
165extern vm_object_t kernel_object; /* the single kernel object */
166extern vm_object_t kmem_object;
167
168#endif /* _KERNEL */
169
170#ifdef _KERNEL
171
172/*
173 * For now a global vm lock.
174 */
175#define VM_OBJECT_MTX(object) (&vm_mtx)
176
172static __inline void
173vm_object_set_flag(vm_object_t object, u_short bits)
174{
177static __inline void
178vm_object_set_flag(vm_object_t object, u_short bits)
179{
175 atomic_set_short(&object->flags, bits);
180
181 mtx_assert(VM_OBJECT_MTX(object), MA_OWNED);
182 object->flags |= bits;
176}
177
178static __inline void
179vm_object_clear_flag(vm_object_t object, u_short bits)
180{
183}
184
185static __inline void
186vm_object_clear_flag(vm_object_t object, u_short bits)
187{
181 atomic_clear_short(&object->flags, bits);
188
189 mtx_assert(VM_OBJECT_MTX(object), MA_OWNED);
190 object->flags &= ~bits;
182}
183
184static __inline void
185vm_object_pip_add(vm_object_t object, short i)
186{
191}
192
193static __inline void
194vm_object_pip_add(vm_object_t object, short i)
195{
187 atomic_add_short(&object->paging_in_progress, i);
196
197 mtx_assert(VM_OBJECT_MTX(object), MA_OWNED);
198 object->paging_in_progress += i;
188}
189
190static __inline void
191vm_object_pip_subtract(vm_object_t object, short i)
192{
199}
200
201static __inline void
202vm_object_pip_subtract(vm_object_t object, short i)
203{
193 atomic_subtract_short(&object->paging_in_progress, i);
204
205 mtx_assert(VM_OBJECT_MTX(object), MA_OWNED);
206 object->paging_in_progress -= i;
194}
195
196static __inline void
197vm_object_pip_wakeup(vm_object_t object)
198{
207}
208
209static __inline void
210vm_object_pip_wakeup(vm_object_t object)
211{
199 atomic_subtract_short(&object->paging_in_progress, 1);
212
213 mtx_assert(VM_OBJECT_MTX(object), MA_OWNED);
214 object->paging_in_progress--;
200 if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) {
201 vm_object_clear_flag(object, OBJ_PIPWNT);
202 wakeup(object);
203 }
204}
205
206static __inline void
207vm_object_pip_wakeupn(vm_object_t object, short i)
208{
215 if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) {
216 vm_object_clear_flag(object, OBJ_PIPWNT);
217 wakeup(object);
218 }
219}
220
221static __inline void
222vm_object_pip_wakeupn(vm_object_t object, short i)
223{
224
225 mtx_assert(VM_OBJECT_MTX(object), MA_OWNED);
209 if (i)
226 if (i)
210 atomic_subtract_short(&object->paging_in_progress, i);
227 object->paging_in_progress -= i;
211 if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) {
212 vm_object_clear_flag(object, OBJ_PIPWNT);
213 wakeup(object);
214 }
215}
216
217static __inline void
218vm_object_pip_sleep(vm_object_t object, char *waitid)
219{
228 if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) {
229 vm_object_clear_flag(object, OBJ_PIPWNT);
230 wakeup(object);
231 }
232}
233
234static __inline void
235vm_object_pip_sleep(vm_object_t object, char *waitid)
236{
237
238 mtx_assert(VM_OBJECT_MTX(object), MA_OWNED);
220 if (object->paging_in_progress) {
221 int s = splvm();
222 if (object->paging_in_progress) {
223 vm_object_set_flag(object, OBJ_PIPWNT);
239 if (object->paging_in_progress) {
240 int s = splvm();
241 if (object->paging_in_progress) {
242 vm_object_set_flag(object, OBJ_PIPWNT);
224 tsleep(object, PVM, waitid, 0);
243 msleep(object, VM_OBJECT_MTX(object), PVM, waitid, 0);
225 }
226 splx(s);
227 }
228}
229
230static __inline void
231vm_object_pip_wait(vm_object_t object, char *waitid)
232{
244 }
245 splx(s);
246 }
247}
248
249static __inline void
250vm_object_pip_wait(vm_object_t object, char *waitid)
251{
252
253 mtx_assert(VM_OBJECT_MTX(object), MA_OWNED);
233 while (object->paging_in_progress)
234 vm_object_pip_sleep(object, waitid);
235}
236
237vm_object_t vm_object_allocate __P((objtype_t, vm_size_t));
238void _vm_object_allocate __P((objtype_t, vm_size_t, vm_object_t));
239boolean_t vm_object_coalesce __P((vm_object_t, vm_pindex_t, vm_size_t, vm_size_t));
240void vm_object_collapse __P((vm_object_t));

--- 16 unchanged lines hidden ---
254 while (object->paging_in_progress)
255 vm_object_pip_sleep(object, waitid);
256}
257
258vm_object_t vm_object_allocate __P((objtype_t, vm_size_t));
259void _vm_object_allocate __P((objtype_t, vm_size_t, vm_object_t));
260boolean_t vm_object_coalesce __P((vm_object_t, vm_pindex_t, vm_size_t, vm_size_t));
261void vm_object_collapse __P((vm_object_t));

--- 16 unchanged lines hidden ---