Lines Matching defs:seg
62 #include <vm/seg.h>
219 * htag0 argument can be a seg or amp pointer.
221 #define P_HASHBP(seg, htag0, addr, flags) \
228 (flags >> 16) : page_get_shift((seg)->s_szc))))]))
231 * htag0 argument can be a seg or amp pointer.
418 * for non wired shadow lists. The caller already holds a per seg/amp list
459 * active count. If amp is not NULL use amp as a lookup tag otherwise use seg
463 seg_plookup(struct seg *seg, struct anon_map *amp, caddr_t addr, size_t len,
470 ASSERT(seg != NULL);
482 htag0 = (amp == NULL ? (void *)seg : (void *)amp);
483 hp = P_HASHBP(seg, htag0, addr, flags);
521 * otherwise use seg as a lookup tag.
524 seg_pinactive(struct seg *seg, struct anon_map *amp, caddr_t addr,
536 ASSERT(seg != NULL);
539 htag0 = (amp == NULL ? (void *)seg : (void *)amp);
549 * Grab per seg/amp lock before hash lock if we are going to remove
554 pheadp = &seg->s_phead;
555 pmtx = &seg->s_pmtx;
563 hp = P_HASHBP(seg, htag0, addr, flags);
681 * seg/amp list lock since we already hold hash lock
682 * and seg/amp list lock is above hash lock in lock
689 pheadp = &seg->s_phead;
690 pmtx = &seg->s_pmtx;
739 seg_pinsert_check(struct seg *seg, struct anon_map *amp, caddr_t addr,
742 ASSERT(seg != NULL);
782 * the same bucket. amp is used instead of seg if amp is not NULL. Non wired
784 * entries can be found quickly during seg/amp purge without walking the
791 * Both hash bucket and per seg/amp locks need to be held before adding a non
792 * wired entry to hash and per seg/amp lists. per seg/amp lock should be taken
800 seg_pinsert(struct seg *seg, struct anon_map *amp, caddr_t addr, size_t len,
811 ASSERT(seg != NULL);
843 * If amp is not NULL set htag0 to amp otherwise set it to seg.
846 pcp->p_htag0 = (void *)seg;
860 hp = P_HASHBP(seg, pcp->p_htag0, addr, flags);
865 pheadp = &seg->s_phead;
866 pmtx = &seg->s_pmtx;
867 htag0 = (void *)seg;
1165 * why we don't need to hold as/seg/amp locks to execute the callback.
1191 * are identified by pp array. This is useful for multiple seg's cached on
1236 * need to hold as/seg locks to execute the callback.
1269 seg_ppurge(struct seg *seg, struct anon_map *amp, uint_t flags)
1283 * If amp is not NULL use amp as a lookup tag otherwise use seg
1286 htag0 = (amp == NULL ? (void *)seg : (void *)amp);
1289 hp = P_HASHBP(seg, htag0, 0, flags);
1313 ASSERT(seg != NULL);
1314 pheadp = &seg->s_phead;
1315 pmtx = &seg->s_pmtx;
1565 seg_cache = kmem_cache_create("seg_cache", sizeof (struct seg),
1582 struct seg *
1585 struct seg *new;
1594 return ((struct seg *)NULL); /* bad virtual addr range */
1599 return ((struct seg *)NULL); /* bad virtual addr range */
1611 return ((struct seg *)NULL);
1622 seg_attach(struct as *as, caddr_t base, size_t size, struct seg *seg)
1624 seg->s_as = as;
1625 seg->s_base = base;
1626 seg->s_size = size;
1633 return (as_addseg(as, seg));
1646 seg_unmap(struct seg *seg)
1652 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as));
1655 ASSERT(seg->s_data != NULL);
1659 ret = SEGOP_UNMAP(seg, seg->s_base, seg->s_size);
1662 SEGOP_UNMAP(seg, seg->s_base, seg->s_size);
1676 seg_free(struct seg *seg)
1678 register struct as *as = seg->s_as;
1679 struct seg *tseg = as_removeseg(as, seg);
1681 ASSERT(tseg == seg);
1687 if (seg->s_data != NULL)
1688 SEGOP_FREE(seg);
1690 mutex_destroy(&seg->s_pmtx);
1691 ASSERT(seg->s_phead.p_lnext == &seg->s_phead);
1692 ASSERT(seg->s_phead.p_lprev == &seg->s_phead);
1693 kmem_cache_free(seg_cache, seg);
1822 seg_can_change_zones(struct seg *seg)
1826 if (seg->s_ops == &segspt_shmops)
1829 if (seg->s_ops == &segvn_ops) {
1830 svd = (struct segvn_data *)seg->s_data;
1843 seg_swresv(struct seg *seg)
1848 if (seg->s_ops == &segvn_ops) {
1849 svd = (struct segvn_data *)seg->s_data;
1861 seg_inherit_notsup(struct seg *seg, caddr_t addr, size_t len, uint_t op)