vm_object.h (38135) | vm_object.h (38517) |
---|---|
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 * $Id: vm_object.h,v 1.49 1998/05/04 17:12:53 dyson Exp $ | 64 * $Id: vm_object.h,v 1.50 1998/08/06 08:33:19 dfr Exp $ |
65 */ 66 67/* 68 * Virtual memory object module definitions. 69 */ 70 71#ifndef _VM_OBJECT_ 72#define _VM_OBJECT_ 73 74#include <sys/queue.h> | 65 */ 66 67/* 68 * Virtual memory object module definitions. 69 */ 70 71#ifndef _VM_OBJECT_ 72#define _VM_OBJECT_ 73 74#include <sys/queue.h> |
75#include <machine/atomic.h> |
|
75 76enum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_DEAD }; 77typedef enum obj_type objtype_t; 78 79/* 80 * Types defined: 81 * 82 * vm_object_t Virtual memory object. --- 74 unchanged lines hidden (view full) --- 157extern vm_object_t kernel_object; /* the single kernel object */ 158extern vm_object_t kmem_object; 159 160#endif /* KERNEL */ 161 162#ifdef KERNEL 163 164static __inline void | 76 77enum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_DEAD }; 78typedef enum obj_type objtype_t; 79 80/* 81 * Types defined: 82 * 83 * vm_object_t Virtual memory object. --- 74 unchanged lines hidden (view full) --- 158extern vm_object_t kernel_object; /* the single kernel object */ 159extern vm_object_t kmem_object; 160 161#endif /* KERNEL */ 162 163#ifdef KERNEL 164 165static __inline void |
166vm_object_set_flag(vm_object_t object, u_int bits) 167{ 168 atomic_set_short(&object->flags, bits); 169} 170 171static __inline void 172vm_object_clear_flag(vm_object_t object, u_int bits) 173{ 174 atomic_clear_short(&object->flags, bits); 175} 176 177static __inline void |
|
165vm_object_pip_add(vm_object_t object, int i) 166{ | 178vm_object_pip_add(vm_object_t object, int i) 179{ |
167 int s = splvm(); 168 object->paging_in_progress += i; 169 splx(s); | 180 atomic_add_short(&object->paging_in_progress, i); |
170} 171 172static __inline void | 181} 182 183static __inline void |
184vm_object_pip_subtract(vm_object_t object, int i) 185{ 186 atomic_subtract_short(&object->paging_in_progress, i); 187} 188 189static __inline void |
|
173vm_object_pip_wakeup(vm_object_t object) 174{ | 190vm_object_pip_wakeup(vm_object_t object) 191{ |
175 int s = splvm(); 176 object->paging_in_progress--; 177 splx(s); | 192 atomic_subtract_short(&object->paging_in_progress, 1); |
178 if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) { | 193 if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) { |
179 object->flags &= ~OBJ_PIPWNT; | 194 vm_object_clear_flag(object, OBJ_PIPWNT); |
180 wakeup(object); 181 } 182} 183 184static __inline void 185vm_object_pip_sleep(vm_object_t object, char *waitid) 186{ 187 int s; 188 189 if (object->paging_in_progress) { 190 s = splvm(); 191 if (object->paging_in_progress) { | 195 wakeup(object); 196 } 197} 198 199static __inline void 200vm_object_pip_sleep(vm_object_t object, char *waitid) 201{ 202 int s; 203 204 if (object->paging_in_progress) { 205 s = splvm(); 206 if (object->paging_in_progress) { |
192 object->flags |= OBJ_PIPWNT; | 207 vm_object_set_flag(object, OBJ_PIPWNT); |
193 tsleep(object, PVM, waitid, 0); 194 } 195 splx(s); 196 } 197} 198 199static __inline void 200vm_object_pip_wait(vm_object_t object, char *waitid) --- 26 unchanged lines hidden --- | 208 tsleep(object, PVM, waitid, 0); 209 } 210 splx(s); 211 } 212} 213 214static __inline void 215vm_object_pip_wait(vm_object_t object, char *waitid) --- 26 unchanged lines hidden --- |