Lines Matching refs:smp
134 size_t len, enum seg_rw rw, struct smap *smp);
135 static void segmap_smapadd(struct smap *smp);
136 static struct smap *segmap_hashin(struct smap *smp, struct vnode *vp,
138 static void segmap_hashout(struct smap *smp);
253 #define SMP2SMF(smp) (&smd_free[(smp - smd_smap) & smd_freemsk]) argument
254 #define SMP2SMF_NDX(smp) (ushort_t)((smp - smd_smap) & smd_freemsk) argument
256 #define SMAPMTX(smp) (&smp->sm_mtx) argument
303 struct smap *smp; in segmap_create() local
406 for (smp = &smd->smd_sm[MAP_PAGES(seg) - 1]; in segmap_create()
407 smp >= smd->smd_sm; smp--) { in segmap_create()
411 prefetch_smap_w((char *)smp); in segmap_create()
413 smp->sm_vp = NULL; in segmap_create()
414 smp->sm_hash = NULL; in segmap_create()
415 smp->sm_off = 0; in segmap_create()
416 smp->sm_bitmap = 0; in segmap_create()
417 smp->sm_refcnt = 0; in segmap_create()
418 mutex_init(&smp->sm_mtx, NULL, MUTEX_DEFAULT, NULL); in segmap_create()
419 smp->sm_free_ndx = SMP2SMF_NDX(smp); in segmap_create()
421 sm = SMP2SMF(smp); in segmap_create()
426 releq->smq_free = smp->sm_next = smp->sm_prev = smp; in segmap_create()
428 smp->sm_next = smpfreelist; in segmap_create()
429 smp->sm_prev = smpfreelist->sm_prev; in segmap_create()
430 smpfreelist->sm_prev = smp; in segmap_create()
431 smp->sm_prev->sm_next = smp; in segmap_create()
432 releq->smq_free = smp->sm_next; in segmap_create()
438 smp->sm_flags = 0; in segmap_create()
445 smp->sm_kpme_next = NULL; in segmap_create()
446 smp->sm_kpme_prev = NULL; in segmap_create()
447 smp->sm_kpme_page = NULL; in segmap_create()
497 struct smap *smp) in segmap_unlock() argument
505 ASSERT(smp->sm_refcnt > 0); in segmap_unlock()
524 vp = smp->sm_vp; in segmap_unlock()
525 off = smp->sm_off + (u_offset_t)((uintptr_t)addr & MAXBOFFSET); in segmap_unlock()
554 bitmask = SMAP_BIT_MASK((off - smp->sm_off) >> PAGESHIFT); in segmap_unlock()
560 ASSERT((u_offset_t)(off - smp->sm_off) <= INT_MAX); in segmap_unlock()
561 smtx = SMAPMTX(smp); in segmap_unlock()
563 if (smp->sm_bitmap & bitmask) { in segmap_unlock()
564 smp->sm_bitmap &= ~bitmask; in segmap_unlock()
591 struct smap *smp; in segmap_fault() local
619 if ((smp = get_smap_kpm(addr, NULL)) == NULL) { in segmap_fault()
625 smtx = SMAPMTX(smp); in segmap_fault()
627 newpage = smp->sm_flags & SM_KPM_NEWPAGE; in segmap_fault()
630 (void *)smp); in segmap_fault()
639 vp = smp->sm_vp; in segmap_fault()
640 sm_off = smp->sm_off; in segmap_fault()
645 ASSERT(smp->sm_refcnt > 0); in segmap_fault()
678 smp = GET_SMAP(seg, addr); in segmap_fault()
679 vp = smp->sm_vp; in segmap_fault()
680 sm_off = smp->sm_off; in segmap_fault()
685 ASSERT(smp->sm_refcnt > 0); in segmap_fault()
699 segmap_unlock(hat, seg, addr, len, rw, smp); in segmap_fault()
777 struct smap *smp; in segmap_faulta() local
794 if ((smp = get_smap_kpm(addr, NULL)) == NULL) { in segmap_faulta()
800 smtx = SMAPMTX(smp); in segmap_faulta()
801 newpage = smp->sm_flags & SM_KPM_NEWPAGE; in segmap_faulta()
805 (void *)smp); in segmap_faulta()
811 smp = GET_SMAP(seg, addr); in segmap_faulta()
813 ASSERT(smp->sm_refcnt > 0); in segmap_faulta()
815 vp = smp->sm_vp; in segmap_faulta()
816 off = smp->sm_off; in segmap_faulta()
927 segmap_smapadd(struct smap *smp) in segmap_smapadd() argument
933 ASSERT(MUTEX_HELD(SMAPMTX(smp))); in segmap_smapadd()
935 if (smp->sm_refcnt != 0) { in segmap_smapadd()
940 sm = &smd_free[smp->sm_free_ndx]; in segmap_smapadd()
950 smp->sm_flags |= SM_QNDX_ZERO; in segmap_smapadd()
952 smp->sm_flags &= ~SM_QNDX_ZERO; in segmap_smapadd()
958 releq->smq_free = smp->sm_next = smp->sm_prev = smp; in segmap_smapadd()
979 smp->sm_next = smpfreelist; in segmap_smapadd()
980 smp->sm_prev = smpfreelist->sm_prev; in segmap_smapadd()
981 smpfreelist->sm_prev = smp; in segmap_smapadd()
982 smp->sm_prev->sm_next = smp; in segmap_smapadd()
989 segmap_hashin(struct smap *smp, struct vnode *vp, u_offset_t off, int hashid) in segmap_hashin() argument
995 ASSERT(MUTEX_HELD(SMAPMTX(smp))); in segmap_hashin()
996 ASSERT(smp->sm_vp == NULL); in segmap_hashin()
997 ASSERT(smp->sm_hash == NULL); in segmap_hashin()
998 ASSERT(smp->sm_prev == NULL); in segmap_hashin()
999 ASSERT(smp->sm_next == NULL); in segmap_hashin()
1032 smp->sm_vp = vp; in segmap_hashin()
1033 smp->sm_off = off; in segmap_hashin()
1036 smp->sm_hash = *hpp; in segmap_hashin()
1037 *hpp = smp; in segmap_hashin()
1048 segmap_hashout(struct smap *smp) in segmap_hashout() argument
1056 ASSERT(MUTEX_HELD(SMAPMTX(smp))); in segmap_hashout()
1058 vp = smp->sm_vp; in segmap_hashout()
1059 off = smp->sm_off; in segmap_hashout()
1072 if (hp == smp) in segmap_hashout()
1077 *hpp = smp->sm_hash; in segmap_hashout()
1078 smp->sm_hash = NULL; in segmap_hashout()
1084 smp->sm_vp = NULL; in segmap_hashout()
1085 smp->sm_off = (u_offset_t)0; in segmap_hashout()
1124 grab_smp(struct smap *smp, page_t *pp) in grab_smp() argument
1126 ASSERT(MUTEX_HELD(SMAPMTX(smp))); in grab_smp()
1127 ASSERT(smp->sm_refcnt == 0); in grab_smp()
1129 if (smp->sm_vp != (struct vnode *)NULL) { in grab_smp()
1130 struct vnode *vp = smp->sm_vp; in grab_smp()
1131 u_offset_t off = smp->sm_off; in grab_smp()
1138 segmap_hashout(smp); in grab_smp()
1154 hat_kpm_mapout(pp, GET_KPME(smp), vaddr); in grab_smp()
1162 if (smp->sm_flags & SM_NOTKPM_RELEASED) { in grab_smp()
1164 smp->sm_flags &= ~SM_NOTKPM_RELEASED; in grab_smp()
1169 ((smp - smd_smap) * MAXBSIZE), in grab_smp()
1174 ASSERT(smp->sm_flags & SM_NOTKPM_RELEASED); in grab_smp()
1175 smp->sm_flags &= ~SM_NOTKPM_RELEASED; in grab_smp()
1177 ((smp - smd_smap) * MAXBSIZE), in grab_smp()
1189 struct smap *smp, *first; in get_free_smp() local
1202 if ((smp = allocq->smq_free) == NULL) { in get_free_smp()
1279 first = smp; in get_free_smp()
1281 smtx = SMAPMTX(smp); in get_free_smp()
1287 if ((smp = smp->sm_next) == first) { in get_free_smp()
1296 if (segmap_kpm && smp->sm_vp != NULL) { in get_free_smp()
1298 kpme = GET_KPME(smp); in get_free_smp()
1303 smp = smp->sm_next; in get_free_smp()
1309 if (smp == first) { in get_free_smp()
1328 if (first == smp) { in get_free_smp()
1330 allocq->smq_free = smp->sm_next; in get_free_smp()
1337 if (allocq->smq_free == smp) in get_free_smp()
1343 smp->sm_prev->sm_next = smp->sm_next; in get_free_smp()
1344 smp->sm_next->sm_prev = smp->sm_prev; in get_free_smp()
1347 smp->sm_prev = smp->sm_next = NULL; in get_free_smp()
1354 grab_smp(smp, pp); in get_free_smp()
1356 ASSERT(SMAPMTX(smp) == smtx); in get_free_smp()
1358 return (smp); in get_free_smp()
1384 struct smap *smp; in segmap_pagecreate() local
1402 if ((smp = get_smap_kpm(addr, NULL)) == NULL) { in segmap_pagecreate()
1408 smtx = SMAPMTX(smp); in segmap_pagecreate()
1409 newpage = smp->sm_flags & SM_KPM_NEWPAGE; in segmap_pagecreate()
1410 smp->sm_flags &= ~SM_KPM_NEWPAGE; in segmap_pagecreate()
1421 smp = GET_SMAP(seg, addr); in segmap_pagecreate()
1428 ASSERT(smp->sm_refcnt > 0); in segmap_pagecreate()
1430 vp = smp->sm_vp; in segmap_pagecreate()
1431 off = smp->sm_off + ((u_offset_t)((uintptr_t)addr & MAXBOFFSET)); in segmap_pagecreate()
1459 bitindex = (ushort_t)((off - smp->sm_off) >> PAGESHIFT); in segmap_pagecreate()
1465 ASSERT((u_offset_t)(off - smp->sm_off) <= INT_MAX); in segmap_pagecreate()
1466 smtx = SMAPMTX(smp); in segmap_pagecreate()
1468 smp->sm_bitmap |= SMAP_BIT_MASK(bitindex); in segmap_pagecreate()
1495 struct smap *smp; in segmap_pageunlock() local
1516 if ((smp = get_smap_kpm(addr, NULL)) == NULL) { in segmap_pageunlock()
1522 ASSERT(smp->sm_refcnt > 0); in segmap_pageunlock()
1523 mutex_exit(SMAPMTX(smp)); in segmap_pageunlock()
1528 smp = GET_SMAP(seg, addr); in segmap_pageunlock()
1529 smtx = SMAPMTX(smp); in segmap_pageunlock()
1531 ASSERT(smp->sm_refcnt > 0); in segmap_pageunlock()
1533 vp = smp->sm_vp; in segmap_pageunlock()
1534 off = smp->sm_off + ((u_offset_t)((uintptr_t)addr & MAXBOFFSET)); in segmap_pageunlock()
1537 bitmask = SMAP_BIT_MASK((int)(off - smp->sm_off) >> PAGESHIFT); in segmap_pageunlock()
1543 ASSERT((u_offset_t)(off - smp->sm_off) <= INT_MAX); in segmap_pageunlock()
1550 if (smp->sm_bitmap & bitmask) { in segmap_pageunlock()
1552 smp->sm_bitmap &= ~bitmask; in segmap_pageunlock()
1607 struct smap *smp, *nsmp; in segmap_getmapflt() local
1652 for (smp = smd_hash[hashid].sh_hash_list; in segmap_getmapflt()
1653 smp != NULL; smp = smp->sm_hash) in segmap_getmapflt()
1654 if (smp->sm_vp == vp && smp->sm_off == baseoff) in segmap_getmapflt()
1659 if (smp != NULL) { in segmap_getmapflt()
1668 smapmtx = SMAPMTX(smp); in segmap_getmapflt()
1670 if (smp->sm_vp != vp || smp->sm_off != baseoff) { in segmap_getmapflt()
1675 if (smp->sm_refcnt == 0) { in segmap_getmapflt()
1693 if ((smp->sm_next != NULL)) { in segmap_getmapflt()
1696 ASSERT(smp->sm_prev != NULL); in segmap_getmapflt()
1697 sm = &smd_free[smp->sm_free_ndx]; in segmap_getmapflt()
1699 if (smp->sm_flags & SM_QNDX_ZERO) in segmap_getmapflt()
1705 if (freeq->smq_free != smp) { in segmap_getmapflt()
1709 smp->sm_prev->sm_next = smp->sm_next; in segmap_getmapflt()
1710 smp->sm_next->sm_prev = smp->sm_prev; in segmap_getmapflt()
1711 } else if (smp == smp->sm_next) { in segmap_getmapflt()
1720 freeq->smq_free = smp->sm_next; in segmap_getmapflt()
1721 smp->sm_prev->sm_next = smp->sm_next; in segmap_getmapflt()
1722 smp->sm_next->sm_prev = smp->sm_prev; in segmap_getmapflt()
1725 smp->sm_prev = smp->sm_next = NULL; in segmap_getmapflt()
1727 ASSERT(smp->sm_prev == NULL); in segmap_getmapflt()
1734 smp->sm_refcnt++; /* another user */ in segmap_getmapflt()
1743 smp->sm_flags |= SM_WRITE_DATA; in segmap_getmapflt()
1745 smp->sm_flags |= SM_READ_DATA; in segmap_getmapflt()
1779 smp = get_free_smp(free_ndx); in segmap_getmapflt()
1780 smapmtx = SMAPMTX(smp); in segmap_getmapflt()
1782 ASSERT(smp->sm_vp == NULL); in segmap_getmapflt()
1784 if ((nsmp = segmap_hashin(smp, vp, baseoff, hashid)) != NULL) { in segmap_getmapflt()
1789 segmap_smapadd(smp); in segmap_getmapflt()
1792 smp = nsmp; in segmap_getmapflt()
1795 smp->sm_refcnt++; /* another user */ in segmap_getmapflt()
1804 smp->sm_flags |= SM_WRITE_DATA; in segmap_getmapflt()
1806 smp->sm_flags |= SM_READ_DATA; in segmap_getmapflt()
1827 (smd_cpu+CPU->cpu_seqid)->scpu.scpu_last_smap = smp; in segmap_getmapflt()
1830 baseaddr = segmap_pagecreate_kpm(seg, vp, baseoff, smp, rw); in segmap_getmapflt()
1835 (pp = GET_KPME(smp)->kpe_page) != NULL) { in segmap_getmapflt()
1854 ASSERT(GET_KPME(smp)->kpe_page == NULL); in segmap_getmapflt()
1871 kpme = GET_KPME(smp); in segmap_getmapflt()
1939 kpme = GET_KPME(smp); in segmap_getmapflt()
1956 baseaddr = seg->s_base + ((smp - smd_smap) * MAXBSIZE); in segmap_getmapflt()
1981 struct smap *smp; in segmap_release() local
1998 if ((smp = get_smap_kpm(addr, &pp)) == NULL) { in segmap_release()
2006 seg, addr, smp); in segmap_release()
2008 smtx = SMAPMTX(smp); in segmap_release()
2016 smp->sm_flags &= ~SM_KPM_NEWPAGE; in segmap_release()
2018 if (smp->sm_flags & SM_WRITE_DATA) { in segmap_release()
2020 } else if (smp->sm_flags & SM_READ_DATA) { in segmap_release()
2029 smp = GET_SMAP(seg, addr); in segmap_release()
2033 seg, addr, smp); in segmap_release()
2035 smtx = SMAPMTX(smp); in segmap_release()
2037 smp->sm_flags |= SM_NOTKPM_RELEASED; in segmap_release()
2040 ASSERT(smp->sm_refcnt > 0); in segmap_release()
2061 if (smp->sm_refcnt == 1) { in segmap_release()
2079 vp = smp->sm_vp; in segmap_release()
2080 offset = smp->sm_off; in segmap_release()
2082 if (--smp->sm_refcnt == 0) { in segmap_release()
2084 smp->sm_flags &= ~(SM_WRITE_DATA | SM_READ_DATA); in segmap_release()
2087 segmap_hashout(smp); /* remove map info */ in segmap_release()
2089 hat_kpm_mapout(pp, GET_KPME(smp), addr); in segmap_release()
2090 if (smp->sm_flags & SM_NOTKPM_RELEASED) { in segmap_release()
2091 smp->sm_flags &= ~SM_NOTKPM_RELEASED; in segmap_release()
2093 ((smp - smd_smap) * MAXBSIZE), in segmap_release()
2099 segkpm_mapout_validkpme(GET_KPME(smp)); in segmap_release()
2101 smp->sm_flags &= ~SM_NOTKPM_RELEASED; in segmap_release()
2106 segmap_smapadd(smp); /* add to free list */ in segmap_release()
2134 struct smap *smp, *smp_end; in segmap_dump() local
2142 for (smp = smd->smd_sm, smp_end = smp + smd->smd_npages; in segmap_dump()
2143 smp < smp_end; smp++) { in segmap_dump()
2145 if (smp->sm_refcnt) { in segmap_dump()
2155 if ((pp = page_lookup_nowait(smp->sm_vp, in segmap_dump()
2156 smp->sm_off + off, SE_SHARED))) in segmap_dump()
2159 pp = page_exists(smp->sm_vp, in segmap_dump()
2160 smp->sm_off + off); in segmap_dump()
2217 struct smap *smp, enum seg_rw rw) in segmap_pagecreate_kpm() argument
2224 ASSERT(smp->sm_refcnt > 0); in segmap_pagecreate_kpm()
2240 ASSERT((u_offset_t)(off - smp->sm_off) <= INT_MAX); in segmap_pagecreate_kpm()
2246 smtx = SMAPMTX(smp); in segmap_pagecreate_kpm()
2248 smp->sm_flags |= SM_KPM_NEWPAGE; in segmap_pagecreate_kpm()
2252 kpme = GET_KPME(smp); in segmap_pagecreate_kpm()
2282 struct smap *smp; in get_smap_kpm() local
2305 smp = scpu->scpu.scpu_last_smap; in get_smap_kpm()
2306 mutex_enter(&smp->sm_mtx); in get_smap_kpm()
2307 if (smp->sm_vp == vp && smp->sm_off == offset) { in get_smap_kpm()
2308 ASSERT(smp->sm_refcnt > 0); in get_smap_kpm()
2313 mutex_exit(&smp->sm_mtx); in get_smap_kpm()
2318 smp = smd_hash[hashid].sh_hash_list; in get_smap_kpm()
2319 for (; smp != NULL; smp = smp->sm_hash) { in get_smap_kpm()
2320 if (smp->sm_vp == vp && smp->sm_off == offset) in get_smap_kpm()
2324 if (smp) { in get_smap_kpm()
2325 mutex_enter(&smp->sm_mtx); in get_smap_kpm()
2326 ASSERT(smp->sm_vp == vp && smp->sm_off == offset); in get_smap_kpm()
2331 *ppp = smp ? pp : NULL; in get_smap_kpm()
2333 return (smp); in get_smap_kpm()
2343 struct smap *smp, enum seg_rw rw) in segmap_pagecreate_kpm() argument