125 static size_t segspt_shmswapout(struct seg *seg);
126 static size_t segspt_shmincore(struct seg *seg, caddr_t addr, size_t len,
127 register char *vec);
128 static int segspt_shmsync(struct seg *seg, register caddr_t addr, size_t len,
129 int attr, uint_t flags);
130 static int segspt_shmlockop(struct seg *seg, caddr_t addr, size_t len,
131 int attr, int op, ulong_t *lockmap, size_t pos);
132 static int segspt_shmgetprot(struct seg *seg, caddr_t addr, size_t len,
133 uint_t *protv);
134 static u_offset_t segspt_shmgetoffset(struct seg *seg, caddr_t addr);
135 static int segspt_shmgettype(struct seg *seg, caddr_t addr);
136 static int segspt_shmgetvp(struct seg *seg, caddr_t addr, struct vnode **vpp);
137 static int segspt_shmadvise(struct seg *seg, caddr_t addr, size_t len,
138 uint_t behav);
139 static void segspt_shmdump(struct seg *seg);
140 static int segspt_shmpagelock(struct seg *, caddr_t, size_t,
141 struct page ***, enum lock_type, enum seg_rw);
142 static int segspt_shmsetpgsz(struct seg *, caddr_t, size_t, uint_t);
143 static int segspt_shmgetmemid(struct seg *, caddr_t, memid_t *);
144 static lgrp_mem_policy_info_t *segspt_shmgetpolicy(struct seg *, caddr_t);
145 static int segspt_shmcapable(struct seg *, segcapability_t);
146
147 struct seg_ops segspt_shmops = {
148 .dup = segspt_shmdup,
149 .unmap = segspt_shmunmap,
150 .free = segspt_shmfree,
151 .fault = segspt_shmfault,
152 .faulta = segspt_shmfaulta,
153 .setprot = segspt_shmsetprot,
154 .checkprot = segspt_shmcheckprot,
155 .kluster = segspt_shmkluster,
156 .swapout = segspt_shmswapout,
157 .sync = segspt_shmsync,
158 .incore = segspt_shmincore,
159 .lockop = segspt_shmlockop,
160 .getprot = segspt_shmgetprot,
161 .getoffset = segspt_shmgetoffset,
162 .gettype = segspt_shmgettype,
163 .getvp = segspt_shmgetvp,
164 .advise = segspt_shmadvise,
165 .dump = segspt_shmdump,
166 .pagelock = segspt_shmpagelock,
167 .setpagesize = segspt_shmsetpgsz,
168 .getmemid = segspt_shmgetmemid,
169 .getpolicy = segspt_shmgetpolicy,
170 .capable = segspt_shmcapable,
171 };
172
173 static void segspt_purge(struct seg *seg);
174 static int segspt_reclaim(void *, caddr_t, size_t, struct page **,
175 enum seg_rw, int);
176 static int spt_anon_getpages(struct seg *seg, caddr_t addr, size_t len,
177 page_t **ppa);
178
179
180
181 /*ARGSUSED*/
182 int
183 sptcreate(size_t size, struct seg **sptseg, struct anon_map *amp,
184 uint_t prot, uint_t flags, uint_t share_szc)
185 {
186 int err;
187 struct as *newas;
188 struct segspt_crargs sptcargs;
189
190 #ifdef DEBUG
3088 * Assume that no lock needs to be held on anon_map, since
3089 * it should be protected by its reference count which must be
3090 * nonzero for an existing segment
3091 * Need to grab readers lock on policy tree though
3092 */
3093 shm_data = (struct shm_data *)seg->s_data;
3094 if (shm_data == NULL)
3095 return (NULL);
3096 amp = shm_data->shm_amp;
3097 ASSERT(amp->refcnt != 0);
3098
3099 /*
3100 * Get policy info
3101 *
3102 * Assume starting anon index of 0
3103 */
3104 anon_index = seg_page(seg, addr);
3105 policy_info = lgrp_shm_policy_get(amp, anon_index, NULL, 0);
3106
3107 return (policy_info);
3108 }
3109
3110 /*ARGSUSED*/
3111 static int
3112 segspt_shmcapable(struct seg *seg, segcapability_t capability)
3113 {
3114 return (0);
3115 }
|
125 static size_t segspt_shmswapout(struct seg *seg);
126 static size_t segspt_shmincore(struct seg *seg, caddr_t addr, size_t len,
127 register char *vec);
128 static int segspt_shmsync(struct seg *seg, register caddr_t addr, size_t len,
129 int attr, uint_t flags);
130 static int segspt_shmlockop(struct seg *seg, caddr_t addr, size_t len,
131 int attr, int op, ulong_t *lockmap, size_t pos);
132 static int segspt_shmgetprot(struct seg *seg, caddr_t addr, size_t len,
133 uint_t *protv);
134 static u_offset_t segspt_shmgetoffset(struct seg *seg, caddr_t addr);
135 static int segspt_shmgettype(struct seg *seg, caddr_t addr);
136 static int segspt_shmgetvp(struct seg *seg, caddr_t addr, struct vnode **vpp);
137 static int segspt_shmadvise(struct seg *seg, caddr_t addr, size_t len,
138 uint_t behav);
139 static void segspt_shmdump(struct seg *seg);
140 static int segspt_shmpagelock(struct seg *, caddr_t, size_t,
141 struct page ***, enum lock_type, enum seg_rw);
142 static int segspt_shmsetpgsz(struct seg *, caddr_t, size_t, uint_t);
143 static int segspt_shmgetmemid(struct seg *, caddr_t, memid_t *);
144 static lgrp_mem_policy_info_t *segspt_shmgetpolicy(struct seg *, caddr_t);
145
146 struct seg_ops segspt_shmops = {
147 .dup = segspt_shmdup,
148 .unmap = segspt_shmunmap,
149 .free = segspt_shmfree,
150 .fault = segspt_shmfault,
151 .faulta = segspt_shmfaulta,
152 .setprot = segspt_shmsetprot,
153 .checkprot = segspt_shmcheckprot,
154 .kluster = segspt_shmkluster,
155 .swapout = segspt_shmswapout,
156 .sync = segspt_shmsync,
157 .incore = segspt_shmincore,
158 .lockop = segspt_shmlockop,
159 .getprot = segspt_shmgetprot,
160 .getoffset = segspt_shmgetoffset,
161 .gettype = segspt_shmgettype,
162 .getvp = segspt_shmgetvp,
163 .advise = segspt_shmadvise,
164 .dump = segspt_shmdump,
165 .pagelock = segspt_shmpagelock,
166 .setpagesize = segspt_shmsetpgsz,
167 .getmemid = segspt_shmgetmemid,
168 .getpolicy = segspt_shmgetpolicy,
169 };
170
171 static void segspt_purge(struct seg *seg);
172 static int segspt_reclaim(void *, caddr_t, size_t, struct page **,
173 enum seg_rw, int);
174 static int spt_anon_getpages(struct seg *seg, caddr_t addr, size_t len,
175 page_t **ppa);
176
177
178
179 /*ARGSUSED*/
180 int
181 sptcreate(size_t size, struct seg **sptseg, struct anon_map *amp,
182 uint_t prot, uint_t flags, uint_t share_szc)
183 {
184 int err;
185 struct as *newas;
186 struct segspt_crargs sptcargs;
187
188 #ifdef DEBUG
3086 * Assume that no lock needs to be held on anon_map, since
3087 * it should be protected by its reference count which must be
3088 * nonzero for an existing segment
3089 * Need to grab readers lock on policy tree though
3090 */
3091 shm_data = (struct shm_data *)seg->s_data;
3092 if (shm_data == NULL)
3093 return (NULL);
3094 amp = shm_data->shm_amp;
3095 ASSERT(amp->refcnt != 0);
3096
3097 /*
3098 * Get policy info
3099 *
3100 * Assume starting anon index of 0
3101 */
3102 anon_index = seg_page(seg, addr);
3103 policy_info = lgrp_shm_policy_get(amp, anon_index, NULL, 0);
3104
3105 return (policy_info);
3106 }
|