Lines Matching defs: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])
254 #define SMP2SMF_NDX(smp) (ushort_t)((smp - smd_smap) & smd_freemsk)
256 #define SMAPMTX(smp) (&smp->sm_mtx)
303 struct smap *smp;
406 for (smp = &smd->smd_sm[MAP_PAGES(seg) - 1];
407 smp >= smd->smd_sm; smp--) {
411 prefetch_smap_w((char *)smp);
413 smp->sm_vp = NULL;
414 smp->sm_hash = NULL;
415 smp->sm_off = 0;
416 smp->sm_bitmap = 0;
417 smp->sm_refcnt = 0;
418 mutex_init(&smp->sm_mtx, NULL, MUTEX_DEFAULT, NULL);
419 smp->sm_free_ndx = SMP2SMF_NDX(smp);
421 sm = SMP2SMF(smp);
426 releq->smq_free = smp->sm_next = smp->sm_prev = smp;
428 smp->sm_next = smpfreelist;
429 smp->sm_prev = smpfreelist->sm_prev;
430 smpfreelist->sm_prev = smp;
431 smp->sm_prev->sm_next = smp;
432 releq->smq_free = smp->sm_next;
438 smp->sm_flags = 0;
445 smp->sm_kpme_next = NULL;
446 smp->sm_kpme_prev = NULL;
447 smp->sm_kpme_page = NULL;
497 struct smap *smp)
505 ASSERT(smp->sm_refcnt > 0);
524 vp = smp->sm_vp;
525 off = smp->sm_off + (u_offset_t)((uintptr_t)addr & MAXBOFFSET);
554 bitmask = SMAP_BIT_MASK((off - smp->sm_off) >> PAGESHIFT);
560 ASSERT((u_offset_t)(off - smp->sm_off) <= INT_MAX);
561 smtx = SMAPMTX(smp);
563 if (smp->sm_bitmap & bitmask) {
564 smp->sm_bitmap &= ~bitmask;
591 struct smap *smp;
619 if ((smp = get_smap_kpm(addr, NULL)) == NULL) {
625 smtx = SMAPMTX(smp);
627 newpage = smp->sm_flags & SM_KPM_NEWPAGE;
629 cmn_err(CE_WARN, "segmap_fault: newpage? smp %p",
630 (void *)smp);
639 vp = smp->sm_vp;
640 sm_off = smp->sm_off;
645 ASSERT(smp->sm_refcnt > 0);
678 smp = GET_SMAP(seg, addr);
679 vp = smp->sm_vp;
680 sm_off = smp->sm_off;
685 ASSERT(smp->sm_refcnt > 0);
699 segmap_unlock(hat, seg, addr, len, rw, smp);
777 struct smap *smp;
794 if ((smp = get_smap_kpm(addr, NULL)) == NULL) {
800 smtx = SMAPMTX(smp);
801 newpage = smp->sm_flags & SM_KPM_NEWPAGE;
804 cmn_err(CE_WARN, "segmap_faulta: newpage? smp %p",
805 (void *)smp);
811 smp = GET_SMAP(seg, addr);
813 ASSERT(smp->sm_refcnt > 0);
815 vp = smp->sm_vp;
816 off = smp->sm_off;
927 segmap_smapadd(struct smap *smp)
933 ASSERT(MUTEX_HELD(SMAPMTX(smp)));
935 if (smp->sm_refcnt != 0) {
940 sm = &smd_free[smp->sm_free_ndx];
950 smp->sm_flags |= SM_QNDX_ZERO;
952 smp->sm_flags &= ~SM_QNDX_ZERO;
958 releq->smq_free = smp->sm_next = smp->sm_prev = smp;
979 smp->sm_next = smpfreelist;
980 smp->sm_prev = smpfreelist->sm_prev;
981 smpfreelist->sm_prev = smp;
982 smp->sm_prev->sm_next = smp;
989 segmap_hashin(struct smap *smp, struct vnode *vp, u_offset_t off, int hashid)
995 ASSERT(MUTEX_HELD(SMAPMTX(smp)));
996 ASSERT(smp->sm_vp == NULL);
997 ASSERT(smp->sm_hash == NULL);
998 ASSERT(smp->sm_prev == NULL);
999 ASSERT(smp->sm_next == NULL);
1006 * First we need to verify that no one has created a smp
1032 smp->sm_vp = vp;
1033 smp->sm_off = off;
1036 smp->sm_hash = *hpp;
1037 *hpp = smp;
1048 segmap_hashout(struct smap *smp)
1056 ASSERT(MUTEX_HELD(SMAPMTX(smp)));
1058 vp = smp->sm_vp;
1059 off = smp->sm_off;
1072 if (hp == smp)
1077 *hpp = smp->sm_hash;
1078 smp->sm_hash = NULL;
1084 smp->sm_vp = NULL;
1085 smp->sm_off = (u_offset_t)0;
1124 grab_smp(struct smap *smp, page_t *pp)
1126 ASSERT(MUTEX_HELD(SMAPMTX(smp)));
1127 ASSERT(smp->sm_refcnt == 0);
1129 if (smp->sm_vp != (struct vnode *)NULL) {
1130 struct vnode *vp = smp->sm_vp;
1131 u_offset_t off = smp->sm_off;
1138 segmap_hashout(smp);
1154 hat_kpm_mapout(pp, GET_KPME(smp), vaddr);
1162 if (smp->sm_flags & SM_NOTKPM_RELEASED) {
1164 smp->sm_flags &= ~SM_NOTKPM_RELEASED;
1169 ((smp - smd_smap) * MAXBSIZE),
1174 ASSERT(smp->sm_flags & SM_NOTKPM_RELEASED);
1175 smp->sm_flags &= ~SM_NOTKPM_RELEASED;
1177 ((smp - smd_smap) * MAXBSIZE),
1189 struct smap *smp, *first;
1202 if ((smp = allocq->smq_free) == NULL) {
1216 /* cannot get releq; a free smp may be there now */
1279 first = smp;
1281 smtx = SMAPMTX(smp);
1287 if ((smp = smp->sm_next) == first) {
1296 if (segmap_kpm && smp->sm_vp != NULL) {
1298 kpme = GET_KPME(smp);
1303 smp = smp->sm_next;
1309 if (smp == first) {
1324 * At this point, we've selected smp. Remove smp
1325 * from its freelist. If smp is the first one in
1328 if (first == smp) {
1330 allocq->smq_free = smp->sm_next;
1334 * if the head of the freelist still points to smp,
1337 if (allocq->smq_free == smp)
1343 smp->sm_prev->sm_next = smp->sm_next;
1344 smp->sm_next->sm_prev = smp->sm_prev;
1347 smp->sm_prev = smp->sm_next = NULL;
1354 grab_smp(smp, pp);
1355 /* return smp locked. */
1356 ASSERT(SMAPMTX(smp) == smtx);
1358 return (smp);
1384 struct smap *smp;
1402 if ((smp = get_smap_kpm(addr, NULL)) == NULL) {
1408 smtx = SMAPMTX(smp);
1409 newpage = smp->sm_flags & SM_KPM_NEWPAGE;
1410 smp->sm_flags &= ~SM_KPM_NEWPAGE;
1421 smp = GET_SMAP(seg, addr);
1424 * We don't grab smp mutex here since we assume the smp
1428 ASSERT(smp->sm_refcnt > 0);
1430 vp = smp->sm_vp;
1431 off = smp->sm_off + ((u_offset_t)((uintptr_t)addr & MAXBOFFSET));
1459 bitindex = (ushort_t)((off - smp->sm_off) >> PAGESHIFT);
1465 ASSERT((u_offset_t)(off - smp->sm_off) <= INT_MAX);
1466 smtx = SMAPMTX(smp);
1468 smp->sm_bitmap |= SMAP_BIT_MASK(bitindex);
1495 struct smap *smp;
1516 if ((smp = get_smap_kpm(addr, NULL)) == NULL) {
1522 ASSERT(smp->sm_refcnt > 0);
1523 mutex_exit(SMAPMTX(smp));
1528 smp = GET_SMAP(seg, addr);
1529 smtx = SMAPMTX(smp);
1531 ASSERT(smp->sm_refcnt > 0);
1533 vp = smp->sm_vp;
1534 off = smp->sm_off + ((u_offset_t)((uintptr_t)addr & MAXBOFFSET));
1537 bitmask = SMAP_BIT_MASK((int)(off - smp->sm_off) >> PAGESHIFT);
1543 ASSERT((u_offset_t)(off - smp->sm_off) <= INT_MAX);
1550 if (smp->sm_bitmap & bitmask) {
1552 smp->sm_bitmap &= ~bitmask;
1607 struct smap *smp, *nsmp;
1652 for (smp = smd_hash[hashid].sh_hash_list;
1653 smp != NULL; smp = smp->sm_hash)
1654 if (smp->sm_vp == vp && smp->sm_off == baseoff)
1659 if (smp != NULL) {
1668 smapmtx = SMAPMTX(smp);
1670 if (smp->sm_vp != vp || smp->sm_off != baseoff) {
1675 if (smp->sm_refcnt == 0) {
1681 * could also be an smp that is transitioning from
1684 * unlocked smp that is not on the free list any
1693 if ((smp->sm_next != NULL)) {
1696 ASSERT(smp->sm_prev != NULL);
1697 sm = &smd_free[smp->sm_free_ndx];
1699 if (smp->sm_flags & SM_QNDX_ZERO)
1705 if (freeq->smq_free != smp) {
1709 smp->sm_prev->sm_next = smp->sm_next;
1710 smp->sm_next->sm_prev = smp->sm_prev;
1711 } else if (smp == smp->sm_next) {
1720 freeq->smq_free = smp->sm_next;
1721 smp->sm_prev->sm_next = smp->sm_next;
1722 smp->sm_next->sm_prev = smp->sm_prev;
1725 smp->sm_prev = smp->sm_next = NULL;
1727 ASSERT(smp->sm_prev == NULL);
1734 smp->sm_refcnt++; /* another user */
1743 smp->sm_flags |= SM_WRITE_DATA;
1745 smp->sm_flags |= SM_READ_DATA;
1777 * Get a locked smp slot from the free list.
1779 smp = get_free_smp(free_ndx);
1780 smapmtx = SMAPMTX(smp);
1782 ASSERT(smp->sm_vp == NULL);
1784 if ((nsmp = segmap_hashin(smp, vp, baseoff, hashid)) != NULL) {
1787 * Return the smp we just allocated.
1789 segmap_smapadd(smp);
1792 smp = nsmp;
1795 smp->sm_refcnt++; /* another user */
1804 smp->sm_flags |= SM_WRITE_DATA;
1806 smp->sm_flags |= SM_READ_DATA;
1825 * remember the last smp faulted on this cpu.
1827 (smd_cpu+CPU->cpu_seqid)->scpu.scpu_last_smap = smp;
1830 baseaddr = segmap_pagecreate_kpm(seg, vp, baseoff, smp, rw);
1835 (pp = GET_KPME(smp)->kpe_page) != NULL) {
1854 ASSERT(GET_KPME(smp)->kpe_page == NULL);
1871 kpme = GET_KPME(smp);
1939 kpme = GET_KPME(smp);
1956 baseaddr = seg->s_base + ((smp - smd_smap) * MAXBSIZE);
1981 struct smap *smp;
1998 if ((smp = get_smap_kpm(addr, &pp)) == NULL) {
2005 "segmap_relmap:seg %p addr %p smp %p",
2006 seg, addr, smp);
2008 smtx = SMAPMTX(smp);
2016 smp->sm_flags &= ~SM_KPM_NEWPAGE;
2018 if (smp->sm_flags & SM_WRITE_DATA) {
2020 } else if (smp->sm_flags & SM_READ_DATA) {
2029 smp = GET_SMAP(seg, addr);
2032 "segmap_relmap:seg %p addr %p smp %p",
2033 seg, addr, smp);
2035 smtx = SMAPMTX(smp);
2037 smp->sm_flags |= SM_NOTKPM_RELEASED;
2040 ASSERT(smp->sm_refcnt > 0);
2061 if (smp->sm_refcnt == 1) {
2079 vp = smp->sm_vp;
2080 offset = smp->sm_off;
2082 if (--smp->sm_refcnt == 0) {
2084 smp->sm_flags &= ~(SM_WRITE_DATA | SM_READ_DATA);
2087 segmap_hashout(smp); /* remove map info */
2089 hat_kpm_mapout(pp, GET_KPME(smp), addr);
2090 if (smp->sm_flags & SM_NOTKPM_RELEASED) {
2091 smp->sm_flags &= ~SM_NOTKPM_RELEASED;
2093 ((smp - smd_smap) * MAXBSIZE),
2099 segkpm_mapout_validkpme(GET_KPME(smp));
2101 smp->sm_flags &= ~SM_NOTKPM_RELEASED;
2106 segmap_smapadd(smp); /* add to free list */
2134 struct smap *smp, *smp_end;
2142 for (smp = smd->smd_sm, smp_end = smp + smd->smd_npages;
2143 smp < smp_end; smp++) {
2145 if (smp->sm_refcnt) {
2155 if ((pp = page_lookup_nowait(smp->sm_vp,
2156 smp->sm_off + off, SE_SHARED)))
2159 pp = page_exists(smp->sm_vp,
2160 smp->sm_off + off);
2217 struct smap *smp, enum seg_rw rw)
2224 ASSERT(smp->sm_refcnt > 0);
2240 ASSERT((u_offset_t)(off - smp->sm_off) <= INT_MAX);
2246 smtx = SMAPMTX(smp);
2248 smp->sm_flags |= SM_KPM_NEWPAGE;
2252 kpme = GET_KPME(smp);
2282 struct smap *smp;
2305 smp = scpu->scpu.scpu_last_smap;
2306 mutex_enter(&smp->sm_mtx);
2307 if (smp->sm_vp == vp && smp->sm_off == offset) {
2308 ASSERT(smp->sm_refcnt > 0);
2313 mutex_exit(&smp->sm_mtx);
2318 smp = smd_hash[hashid].sh_hash_list;
2319 for (; smp != NULL; smp = smp->sm_hash) {
2320 if (smp->sm_vp == vp && smp->sm_off == offset)
2324 if (smp) {
2325 mutex_enter(&smp->sm_mtx);
2326 ASSERT(smp->sm_vp == vp && smp->sm_off == offset);
2331 *ppp = smp ? pp : NULL;
2333 return (smp);
2343 struct smap *smp, enum seg_rw rw)