Lines Matching refs:seg
74 static int segspt_create(struct seg *seg, caddr_t argsp);
75 static int segspt_unmap(struct seg *seg, caddr_t raddr, size_t ssize);
76 static void segspt_free(struct seg *seg);
77 static void segspt_free_pages(struct seg *seg, caddr_t addr, size_t len);
78 static lgrp_mem_policy_info_t *segspt_getpolicy(struct seg *seg, caddr_t addr);
116 static int segspt_shmdup(struct seg *seg, struct seg *newseg);
117 static int segspt_shmunmap(struct seg *seg, caddr_t raddr, size_t ssize);
118 static void segspt_shmfree(struct seg *seg);
119 static faultcode_t segspt_shmfault(struct hat *hat, struct seg *seg,
121 static faultcode_t segspt_shmfaulta(struct seg *seg, caddr_t addr);
122 static int segspt_shmsetprot(register struct seg *seg, register caddr_t addr,
124 static int segspt_shmcheckprot(struct seg *seg, caddr_t addr, size_t size,
126 static int segspt_shmkluster(struct seg *seg, caddr_t addr, ssize_t delta);
127 static size_t segspt_shmswapout(struct seg *seg);
128 static size_t segspt_shmincore(struct seg *seg, caddr_t addr, size_t len,
130 static int segspt_shmsync(struct seg *seg, register caddr_t addr, size_t len,
132 static int segspt_shmlockop(struct seg *seg, caddr_t addr, size_t len,
134 static int segspt_shmgetprot(struct seg *seg, caddr_t addr, size_t len,
136 static u_offset_t segspt_shmgetoffset(struct seg *seg, caddr_t addr);
137 static int segspt_shmgettype(struct seg *seg, caddr_t addr);
138 static int segspt_shmgetvp(struct seg *seg, caddr_t addr, struct vnode **vpp);
139 static int segspt_shmadvise(struct seg *seg, caddr_t addr, size_t len,
141 static void segspt_shmdump(struct seg *seg);
142 static int segspt_shmpagelock(struct seg *, caddr_t, size_t,
144 static int segspt_shmsetpgsz(struct seg *, caddr_t, size_t, uint_t);
145 static int segspt_shmgetmemid(struct seg *, caddr_t, memid_t *);
146 static lgrp_mem_policy_info_t *segspt_shmgetpolicy(struct seg *, caddr_t);
147 static int segspt_shmcapable(struct seg *, segcapability_t);
176 static void segspt_purge(struct seg *seg);
179 static int spt_anon_getpages(struct seg *seg, caddr_t addr, size_t len,
186 sptcreate(size_t size, struct seg **sptseg, struct anon_map *amp, in sptcreate()
241 segspt_free(struct seg *seg) in segspt_free() argument
243 struct spt_data *sptd = (struct spt_data *)seg->s_data; in segspt_free()
245 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as)); in segspt_free()
249 segspt_free_pages(seg, seg->s_base, sptd->spt_realsize); in segspt_free()
264 segspt_shmsync(struct seg *seg, caddr_t addr, size_t len, int attr, in segspt_shmsync() argument
267 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmsync()
274 segspt_shmincore(struct seg *seg, caddr_t addr, size_t len, char *vec) in segspt_shmincore() argument
278 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmincore()
279 struct seg *sptseg; in segspt_shmincore()
282 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmincore()
284 seg = seg; in segspt_shmincore()
310 anon_index = seg_page(seg, addr); in segspt_shmincore()
342 segspt_unmap(struct seg *seg, caddr_t raddr, size_t ssize) in segspt_unmap() argument
346 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as)); in segspt_unmap()
359 share_size = page_get_pagesize(seg->s_szc); in segspt_unmap()
362 if (raddr == seg->s_base && ssize == seg->s_size) { in segspt_unmap()
363 seg_free(seg); in segspt_unmap()
370 segspt_create(struct seg *seg, caddr_t argsp) in segspt_create() argument
373 caddr_t addr = seg->s_base; in segspt_create()
397 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as)); in segspt_create()
402 tnf_opaque, addr, addr, tnf_ulong, len, seg->s_size); in segspt_create()
424 seg->s_ops = &segspt_ops; in segspt_create()
429 seg->s_data = (caddr_t)sptd; in segspt_create()
432 seg->s_szc = sptcargs->szc; in segspt_create()
437 if (seg->s_szc > amp->a_szc) { in segspt_create()
438 amp->a_szc = seg->s_szc; in segspt_create()
455 share_sz = page_get_pagesize(seg->s_szc); in segspt_create()
495 sptcargs->seg_spt = seg; in segspt_create()
503 seg, addr, S_CREATE, cred)) != 0) in segspt_create()
566 pgsz = page_get_pagesize(seg->s_szc); in segspt_create()
567 pgcnt = page_get_pagecnt(seg->s_szc); in segspt_create()
570 hat_memload_array(seg->s_as->a_hat, a, sz, in segspt_create()
594 sptcargs->seg_spt = seg; in segspt_create()
598 seg->s_data = NULL; in segspt_create()
615 segspt_free_pages(struct seg *seg, caddr_t addr, size_t len) in segspt_free_pages() argument
618 struct spt_data *sptd = (struct spt_data *)seg->s_data; in segspt_free_pages()
633 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as)); in segspt_free_pages()
645 hat_unload(seg->s_as->a_hat, addr, len, hat_flags); in segspt_free_pages()
779 segspt_getpolicy(struct seg *seg, caddr_t addr) in segspt_getpolicy() argument
786 ASSERT(seg != NULL); in segspt_getpolicy()
796 spt_data = (struct spt_data *)seg->s_data; in segspt_getpolicy()
807 anon_index = seg_page(seg, addr); in segspt_getpolicy()
824 segspt_dismpagelock(struct seg *seg, caddr_t addr, size_t len, in segspt_dismpagelock() argument
827 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_dismpagelock()
828 struct seg *sptseg = shmd->shm_sptseg; in segspt_dismpagelock()
842 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_dismpagelock()
853 pg_idx = seg_page(seg, addr); in segspt_dismpagelock()
868 seg_pinactive(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_dismpagelock()
880 (AS_ISUNMAPWAIT(seg->s_as) && in segspt_dismpagelock()
882 segspt_purge(seg); in segspt_dismpagelock()
890 segspt_purge(seg); in segspt_dismpagelock()
903 pplist = seg_plookup(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_dismpagelock()
911 seg_pinactive(seg, NULL, seg->s_base, in segspt_dismpagelock()
937 pplist = seg_plookup(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_dismpagelock()
946 seg_pinactive(seg, NULL, seg->s_base, in segspt_dismpagelock()
968 if (seg_pinsert_check(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_dismpagelock()
1070 ret = seg_pinsert(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_dismpagelock()
1100 seg_pinactive(seg, NULL, seg->s_base, in segspt_dismpagelock()
1155 if (AS_ISUNMAPWAIT(seg->s_as)) { in segspt_dismpagelock()
1156 mutex_enter(&seg->s_as->a_contents); in segspt_dismpagelock()
1157 if (AS_ISUNMAPWAIT(seg->s_as)) { in segspt_dismpagelock()
1158 AS_CLRUNMAPWAIT(seg->s_as); in segspt_dismpagelock()
1159 cv_broadcast(&seg->s_as->a_cv); in segspt_dismpagelock()
1161 mutex_exit(&seg->s_as->a_contents); in segspt_dismpagelock()
1180 segspt_shmpagelock(struct seg *seg, caddr_t addr, size_t len, in segspt_shmpagelock() argument
1183 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmpagelock()
1184 struct seg *sptseg = shmd->shm_sptseg; in segspt_shmpagelock()
1197 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmpagelock()
1210 return (segspt_dismpagelock(seg, addr, len, ppp, type, rw)); in segspt_shmpagelock()
1213 page_index = seg_page(seg, addr); in segspt_shmpagelock()
1229 seg_pinactive(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_shmpagelock()
1240 if (AS_ISUNMAPWAIT(seg->s_as) && (shmd->shm_softlockcnt > 0)) { in segspt_shmpagelock()
1241 segspt_purge(seg); in segspt_shmpagelock()
1252 pplist = seg_plookup(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_shmpagelock()
1271 pplist = seg_plookup(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_shmpagelock()
1285 if (seg_pinsert_check(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_shmpagelock()
1349 ret = seg_pinsert(seg, NULL, seg->s_base, sptd->spt_amp->size, in segspt_shmpagelock()
1412 if (AS_ISUNMAPWAIT(seg->s_as)) { in segspt_shmpagelock()
1413 mutex_enter(&seg->s_as->a_contents); in segspt_shmpagelock()
1414 if (AS_ISUNMAPWAIT(seg->s_as)) { in segspt_shmpagelock()
1415 AS_CLRUNMAPWAIT(seg->s_as); in segspt_shmpagelock()
1416 cv_broadcast(&seg->s_as->a_cv); in segspt_shmpagelock()
1418 mutex_exit(&seg->s_as->a_contents); in segspt_shmpagelock()
1429 segspt_purge(struct seg *seg) in segspt_purge() argument
1431 seg_ppurge(seg, NULL, SEGP_FORCE_WIRED); in segspt_purge()
1438 struct seg *seg = (struct seg *)ptag; in segspt_reclaim() local
1439 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_reclaim()
1440 struct seg *sptseg; in segspt_reclaim()
1455 ASSERT(async || AS_LOCK_HELD(seg->s_as)); in segspt_reclaim()
1528 if (async || AS_ISUNMAPWAIT(seg->s_as)) { in segspt_reclaim()
1529 mutex_enter(&seg->s_as->a_contents); in segspt_reclaim()
1531 AS_SETNOUNMAPWAIT(seg->s_as); in segspt_reclaim()
1532 if (AS_ISUNMAPWAIT(seg->s_as)) { in segspt_reclaim()
1533 AS_CLRUNMAPWAIT(seg->s_as); in segspt_reclaim()
1534 cv_broadcast(&seg->s_as->a_cv); in segspt_reclaim()
1536 mutex_exit(&seg->s_as->a_contents); in segspt_reclaim()
1574 segspt_softunlock(struct seg *seg, caddr_t sptseg_addr, in segspt_softunlock() argument
1577 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_softunlock()
1578 struct seg *sptseg; in segspt_softunlock()
1589 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_softunlock()
1660 if (AS_ISUNMAPWAIT(seg->s_as)) { in segspt_softunlock()
1661 mutex_enter(&seg->s_as->a_contents); in segspt_softunlock()
1662 if (AS_ISUNMAPWAIT(seg->s_as)) { in segspt_softunlock()
1663 AS_CLRUNMAPWAIT(seg->s_as); in segspt_softunlock()
1664 cv_broadcast(&seg->s_as->a_cv); in segspt_softunlock()
1666 mutex_exit(&seg->s_as->a_contents); in segspt_softunlock()
1672 segspt_shmattach(struct seg *seg, caddr_t *argsp) in segspt_shmattach() argument
1680 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as)); in segspt_shmattach()
1691 NULL, 0, seg->s_size); in segspt_shmattach()
1695 seg->s_data = (void *)shmd; in segspt_shmattach()
1696 seg->s_ops = &segspt_shmops; in segspt_shmattach()
1697 seg->s_szc = shmd->shm_sptseg->s_szc; in segspt_shmattach()
1703 seg->s_data = (void *)NULL; in segspt_shmattach()
1709 if ((error = hat_share(seg->s_as->a_hat, seg->s_base, in segspt_shmattach()
1711 seg->s_size, seg->s_szc)) != 0) { in segspt_shmattach()
1717 error = hat_share(seg->s_as->a_hat, seg->s_base, in segspt_shmattach()
1719 seg->s_size, seg->s_szc); in segspt_shmattach()
1722 seg->s_szc = 0; in segspt_shmattach()
1723 seg->s_data = (void *)NULL; in segspt_shmattach()
1734 segspt_shmunmap(struct seg *seg, caddr_t raddr, size_t ssize) in segspt_shmunmap() argument
1736 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmunmap()
1739 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as)); in segspt_shmunmap()
1743 segspt_purge(seg); in segspt_shmunmap()
1750 if (ssize != seg->s_size) { in segspt_shmunmap()
1753 ssize, seg->s_size); in segspt_shmunmap()
1758 (void) segspt_shmlockop(seg, raddr, shmd->shm_amp->size, 0, MC_UNLOCK, in segspt_shmunmap()
1760 hat_unshare(seg->s_as->a_hat, raddr, ssize, seg->s_szc); in segspt_shmunmap()
1762 seg_free(seg); in segspt_shmunmap()
1768 segspt_shmfree(struct seg *seg) in segspt_shmfree() argument
1770 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmfree()
1773 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as)); in segspt_shmfree()
1775 (void) segspt_shmlockop(seg, seg->s_base, shm_amp->size, 0, in segspt_shmfree()
1804 segspt_shmsetprot(struct seg *seg, caddr_t addr, size_t len, uint_t prot) in segspt_shmsetprot() argument
1806 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmsetprot()
1821 segspt_dismfault(struct hat *hat, struct seg *seg, caddr_t addr, in segspt_dismfault() argument
1824 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_dismfault()
1825 struct seg *sptseg = shmd->shm_sptseg; in segspt_dismfault()
1844 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_dismfault()
1856 ASSERT(addr >= seg->s_base); in segspt_dismfault()
1857 if (((addr + len) - seg->s_base) > sptd->spt_realsize) in segspt_dismfault()
1881 an_idx = seg_page(seg, shm_addr); in segspt_dismfault()
1928 if (hat == seg->s_as->a_hat) { in segspt_dismfault()
1934 page_migrate(seg, shm_addr, ppa, in segspt_dismfault()
1962 if (hat_share(seg->s_as->a_hat, shm_addr, in segspt_dismfault()
1964 seg->s_szc) != 0) { in segspt_dismfault()
1986 segspt_softunlock(seg, segspt_addr, size, rw); in segspt_dismfault()
2014 segspt_shmfault(struct hat *hat, struct seg *seg, caddr_t addr, in segspt_shmfault() argument
2017 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmfault()
2018 struct seg *sptseg = shmd->shm_sptseg; in segspt_shmfault()
2041 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmfault()
2044 return (segspt_dismfault(hat, seg, addr, len, type, rw)); in segspt_shmfault()
2057 ASSERT(addr >= seg->s_base); in segspt_shmfault()
2058 if (((addr + len) - seg->s_base) > sptd->spt_realsize) in segspt_shmfault()
2082 anon_index = seg_page(seg, shm_addr); in segspt_shmfault()
2134 if (hat_share(seg->s_as->a_hat, seg->s_base, in segspt_shmfault()
2188 if (hat == seg->s_as->a_hat) { in segspt_shmfault()
2194 page_migrate(seg, shm_addr, ppa, in segspt_shmfault()
2229 segspt_softunlock(seg, sptseg_addr, ptob(npages), rw); in segspt_shmfault()
2256 segspt_shmfaulta(struct seg *seg, caddr_t addr) in segspt_shmfaulta() argument
2263 segspt_shmkluster(struct seg *seg, caddr_t addr, ssize_t delta) in segspt_shmkluster() argument
2270 segspt_shmswapout(struct seg *seg) in segspt_shmswapout() argument
2279 segspt_shmdup(struct seg *seg, struct seg *newseg) in segspt_shmdup() argument
2281 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmdup()
2284 struct seg *spt_seg = shmd->shm_sptseg; in segspt_shmdup()
2288 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as)); in segspt_shmdup()
2296 newseg->s_szc = seg->s_szc; in segspt_shmdup()
2297 ASSERT(seg->s_szc == shmd->shm_sptseg->s_szc); in segspt_shmdup()
2309 seg->s_size, seg->s_szc)) != 0) { in segspt_shmdup()
2317 shmd->shm_sptas->a_hat, SEGSPTADDR, seg->s_size, in segspt_shmdup()
2318 seg->s_szc)); in segspt_shmdup()
2325 segspt_shmcheckprot(struct seg *seg, caddr_t addr, size_t size, uint_t prot) in segspt_shmcheckprot() argument
2327 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmcheckprot()
2330 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmcheckprot()
2344 struct seg *sptseg, in spt_anon_getpages()
2500 spt_lockpages(struct seg *seg, pgcnt_t anon_index, pgcnt_t npages, in spt_lockpages() argument
2504 struct shm_data *shmd = seg->s_data; in spt_lockpages()
2588 spt_unlockpages(struct seg *seg, pgcnt_t anon_index, pgcnt_t npages, in spt_unlockpages() argument
2591 struct shm_data *shmd = seg->s_data; in spt_unlockpages()
2661 segspt_shmlockop(struct seg *seg, caddr_t addr, size_t len, in segspt_shmlockop() argument
2664 struct shm_data *shmd = seg->s_data; in segspt_shmlockop()
2665 struct seg *sptseg = shmd->shm_sptseg; in segspt_shmlockop()
2681 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmlockop()
2689 an_idx = seg_page(seg, addr); in segspt_shmlockop()
2716 a_an_idx = seg_page(seg, a_addr); in segspt_shmlockop()
2750 sts = spt_lockpages(seg, an_idx, npages, in segspt_shmlockop()
2789 sts = spt_unlockpages(seg, an_idx, npages, &unlocked); in segspt_shmlockop()
2805 segspt_shmgetprot(struct seg *seg, caddr_t addr, size_t len, uint_t *protv) in segspt_shmgetprot() argument
2807 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmgetprot()
2809 spgcnt_t pgno = seg_page(seg, addr+len) - seg_page(seg, addr) + 1; in segspt_shmgetprot()
2811 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmgetprot()
2823 segspt_shmgetoffset(struct seg *seg, caddr_t addr) in segspt_shmgetoffset() argument
2825 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmgetoffset()
2834 segspt_shmgettype(struct seg *seg, caddr_t addr) in segspt_shmgettype() argument
2836 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmgettype()
2839 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmgettype()
2851 segspt_shmgetvp(struct seg *seg, caddr_t addr, struct vnode **vpp) in segspt_shmgetvp() argument
2853 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmgetvp()
2856 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmgetvp()
2871 segspt_shmadvise(struct seg *seg, caddr_t addr, size_t len, uint_t behav) in segspt_shmadvise() argument
2873 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmadvise()
2882 ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as)); in segspt_shmadvise()
2889 pg_idx = seg_page(seg, addr); in segspt_shmadvise()
2916 writer = AS_WRITE_HELD(seg->s_as); in segspt_shmadvise()
2918 AS_LOCK_EXIT(seg->s_as); in segspt_shmadvise()
2939 AS_LOCK_ENTER(seg->s_as, writer ? RW_WRITER : RW_READER); in segspt_shmadvise()
2942 if (AS_ISUNMAPWAIT(seg->s_as)) { in segspt_shmadvise()
2943 mutex_enter(&seg->s_as->a_contents); in segspt_shmadvise()
2944 if (AS_ISUNMAPWAIT(seg->s_as)) { in segspt_shmadvise()
2945 AS_CLRUNMAPWAIT(seg->s_as); in segspt_shmadvise()
2946 cv_broadcast(&seg->s_as->a_cv); in segspt_shmadvise()
2948 mutex_exit(&seg->s_as->a_contents); in segspt_shmadvise()
2963 struct seg *sptseg = shmd->shm_sptseg; in segspt_shmadvise()
2975 anon_index = seg_page(seg, shm_addr); in segspt_shmadvise()
3009 segspt_purge(seg); in segspt_shmadvise()
3011 page_mark_migrate(seg, shm_addr, size, amp, 0, NULL, 0, 0); in segspt_shmadvise()
3019 segspt_shmdump(struct seg *seg) in segspt_shmdump() argument
3026 segspt_shmsetpgsz(struct seg *seg, caddr_t addr, size_t len, uint_t szc) in segspt_shmsetpgsz() argument
3035 segspt_shmgetmemid(struct seg *seg, caddr_t addr, memid_t *memidp) in segspt_shmgetmemid() argument
3037 struct shm_data *shmd = (struct shm_data *)seg->s_data; in segspt_shmgetmemid()
3042 struct seg *sptseg = shmd->shm_sptseg; in segspt_shmgetmemid()
3045 anon_index = seg_page(seg, addr); in segspt_shmgetmemid()
3047 if (addr > (seg->s_base + sptd->spt_realsize)) { in segspt_shmgetmemid()
3078 segspt_shmgetpolicy(struct seg *seg, caddr_t addr) in segspt_shmgetpolicy() argument
3085 ASSERT(seg != NULL); in segspt_shmgetpolicy()
3095 shm_data = (struct shm_data *)seg->s_data; in segspt_shmgetpolicy()
3106 anon_index = seg_page(seg, addr); in segspt_shmgetpolicy()
3114 segspt_shmcapable(struct seg *seg, segcapability_t capability) in segspt_shmcapable() argument