Deleted Added
full compact
vm_object.h (38517) vm_object.h (42957)
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.50 1998/08/06 08:33:19 dfr Exp $
64 * $Id: vm_object.h,v 1.51 1998/08/24 08:39:37 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>
75#include <machine/atomic.h>
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.
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>
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.
84 *
84 */
85
86struct vm_object {
87 TAILQ_ENTRY(vm_object) object_list; /* list of all objects */
88 TAILQ_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */
89 TAILQ_ENTRY(vm_object) shadow_list; /* chain of shadow objects */
90 TAILQ_HEAD(, vm_page) memq; /* list of resident pages */
91 int generation; /* generation ID */
92 objtype_t type; /* type of pager */
93 vm_size_t size; /* Object size */
94 int ref_count; /* How many refs?? */
95 int shadow_count; /* how many objects that this is a shadow for */
96 int pg_color; /* color of first page in obj */
85 */
86
87struct vm_object {
88 TAILQ_ENTRY(vm_object) object_list; /* list of all objects */
89 TAILQ_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */
90 TAILQ_ENTRY(vm_object) shadow_list; /* chain of shadow objects */
91 TAILQ_HEAD(, vm_page) memq; /* list of resident pages */
92 int generation; /* generation ID */
93 objtype_t type; /* type of pager */
94 vm_size_t size; /* Object size */
95 int ref_count; /* How many refs?? */
96 int shadow_count; /* how many objects that this is a shadow for */
97 int pg_color; /* color of first page in obj */
97 int id; /* ID for no purpose, other than info */
98#if 0
99 int id; /* ID for no purpose, other than info */
100#endif
101 int hash_rand; /* vm hash table randomizer */
98 u_short flags; /* see below */
99 u_short paging_in_progress; /* Paging (in or out) so don't collapse or destroy */
100 u_short behavior; /* see below */
101 int resident_page_count; /* number of resident pages */
102 u_short flags; /* see below */
103 u_short paging_in_progress; /* Paging (in or out) so don't collapse or destroy */
104 u_short behavior; /* see below */
105 int resident_page_count; /* number of resident pages */
102 int cache_count; /* number of cached pages */
103 int wire_count; /* number of wired pages */
104 vm_ooffset_t paging_offset; /* Offset into paging space */
106 int cache_count; /* number of cached pages */
107 int wire_count; /* number of wired pages */
105 struct vm_object *backing_object; /* object that I'm a shadow of */
106 vm_ooffset_t backing_object_offset;/* Offset in backing object */
107 vm_offset_t last_read; /* last read in object -- detect seq behavior */
108 struct vm_object *backing_object; /* object that I'm a shadow of */
109 vm_ooffset_t backing_object_offset;/* Offset in backing object */
110 vm_offset_t last_read; /* last read in object -- detect seq behavior */
108 vm_page_t page_hint; /* hint for last looked-up or allocated page */
109 TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */
110 void *handle;
111 union {
111 TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */
112 void *handle;
113 union {
114 /*
115 * VNode pager
116 *
117 * vnp_size - current size of file
118 */
112 struct {
119 struct {
113 off_t vnp_size; /* Current size of file */
120 off_t vnp_size;
114 } vnp;
121 } vnp;
122
123 /*
124 * Device pager
125 *
126 * devp_pglist - list of allocated pages
127 */
115 struct {
128 struct {
116 TAILQ_HEAD(, vm_page) devp_pglist; /* list of pages allocated */
129 TAILQ_HEAD(, vm_page) devp_pglist;
117 } devp;
130 } devp;
131
132 /*
133 * Swap pager
134 *
135 * swp_bcount - number of swap 'swblock' metablocks, each
136 * contains up to 16 swapblk assignments.
137 * see vm/swap_pager.h
138 */
118 struct {
139 struct {
119 int swp_nblocks;
120 int swp_allocsize;
121 struct swblock *swp_blocks;
122 short swp_poip;
140 int swp_bcount;
123 } swp;
124 } un_pager;
125};
126
127/*
128 * Flags
129 */
130#define OBJ_ACTIVE 0x0004 /* active objects */
131#define OBJ_DEAD 0x0008 /* dead objects (during rundown) */
132#define OBJ_NOSPLIT 0x0010 /* dont split this object */
133#define OBJ_PIPWNT 0x0040 /* paging in progress wanted */
134#define OBJ_WRITEABLE 0x0080 /* object has been made writable */
141 } swp;
142 } un_pager;
143};
144
145/*
146 * Flags
147 */
148#define OBJ_ACTIVE 0x0004 /* active objects */
149#define OBJ_DEAD 0x0008 /* dead objects (during rundown) */
150#define OBJ_NOSPLIT 0x0010 /* dont split this object */
151#define OBJ_PIPWNT 0x0040 /* paging in progress wanted */
152#define OBJ_WRITEABLE 0x0080 /* object has been made writable */
135#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty */
153#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty */
136#define OBJ_CLEANING 0x0200
137#define OBJ_OPT 0x1000 /* I/O optimization */
138#define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */
139
140#define OBJ_NORMAL 0x0 /* default behavior */
141#define OBJ_SEQUENTIAL 0x1 /* expect sequential accesses */
142#define OBJ_RANDOM 0x2 /* expect random accesses */
143

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

192 atomic_subtract_short(&object->paging_in_progress, 1);
193 if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) {
194 vm_object_clear_flag(object, OBJ_PIPWNT);
195 wakeup(object);
196 }
197}
198
199static __inline void
154#define OBJ_CLEANING 0x0200
155#define OBJ_OPT 0x1000 /* I/O optimization */
156#define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */
157
158#define OBJ_NORMAL 0x0 /* default behavior */
159#define OBJ_SEQUENTIAL 0x1 /* expect sequential accesses */
160#define OBJ_RANDOM 0x2 /* expect random accesses */
161

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

210 atomic_subtract_short(&object->paging_in_progress, 1);
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
200vm_object_pip_sleep(vm_object_t object, char *waitid)
218vm_object_pip_wakeupn(vm_object_t object, int i)
201{
219{
202 int s;
220 if (i)
221 atomic_subtract_short(&object->paging_in_progress, i);
222 if ((object->flags & OBJ_PIPWNT) && object->paging_in_progress == 0) {
223 vm_object_clear_flag(object, OBJ_PIPWNT);
224 wakeup(object);
225 }
226}
203
227
228static __inline void
229vm_object_pip_sleep(vm_object_t object, char *waitid)
230{
204 if (object->paging_in_progress) {
231 if (object->paging_in_progress) {
205 s = splvm();
232 int s = splvm();
206 if (object->paging_in_progress) {
207 vm_object_set_flag(object, OBJ_PIPWNT);
208 tsleep(object, PVM, waitid, 0);
209 }
210 splx(s);
211 }
212}
213

--- 28 unchanged lines hidden ---
233 if (object->paging_in_progress) {
234 vm_object_set_flag(object, OBJ_PIPWNT);
235 tsleep(object, PVM, waitid, 0);
236 }
237 splx(s);
238 }
239}
240

--- 28 unchanged lines hidden ---