Lines Matching defs:ahp
293 struct anon_hdr *ahp;
297 if ((ahp = kmem_zalloc(sizeof (struct anon_hdr), kmemflags)) == NULL) {
301 mutex_init(&ahp->serial_lock, NULL, MUTEX_DEFAULT, NULL);
305 ahp->size = npages;
309 ahp->flags |= ANON_ALLOC_FORCE;
311 ahp->array_chunk = kmem_zalloc(
312 ahp->size * sizeof (struct anon *), kmemflags);
314 if (ahp->array_chunk == NULL) {
315 kmem_free(ahp, sizeof (struct anon_hdr));
330 ahp->size = P2ROUNDUP(npages, ANON_CHUNK_SIZE);
331 nchunks = ahp->size >> ANON_CHUNK_SHIFT;
333 ahp->array_chunk = kmem_zalloc(nchunks * sizeof (ulong_t *),
336 if (ahp->array_chunk == NULL) {
337 kmem_free(ahp, sizeof (struct anon_hdr));
341 return (ahp);
348 anon_release(struct anon_hdr *ahp, pgcnt_t npages)
354 ASSERT(npages <= ahp->size);
359 if (npages <= ANON_CHUNK_SIZE || (ahp->flags & ANON_ALLOC_FORCE)) {
360 kmem_free(ahp->array_chunk, ahp->size * sizeof (struct anon *));
365 nchunks = ahp->size >> ANON_CHUNK_SHIFT;
367 ppp = &ahp->array_chunk[i];
371 kmem_free(ahp->array_chunk, nchunks * sizeof (ulong_t *));
373 mutex_destroy(&ahp->serial_lock);
374 kmem_free(ahp, sizeof (struct anon_hdr));
382 anon_get_ptr(struct anon_hdr *ahp, ulong_t an_idx)
386 ASSERT(an_idx < ahp->size);
391 if ((ahp->size <= ANON_CHUNK_SIZE) || (ahp->flags & ANON_ALLOC_FORCE)) {
393 ((uintptr_t)ahp->array_chunk[an_idx] & ANON_PTRMASK));
399 app = ahp->array_chunk[an_idx >> ANON_CHUNK_SHIFT];
415 anon_get_next_ptr(struct anon_hdr *ahp, ulong_t *index)
425 size = ahp->size;
429 if ((size <= ANON_CHUNK_SIZE) || (ahp->flags & ANON_ALLOC_FORCE)) {
435 ((uintptr_t)ahp->array_chunk[i] & ANON_PTRMASK);
448 app = ahp->array_chunk[i >> ANON_CHUNK_SHIFT];
470 anon_set_ptr(struct anon_hdr *ahp, ulong_t an_idx, struct anon *ap, int flags)
477 ASSERT(an_idx < ahp->size);
482 if (ahp->size <= ANON_CHUNK_SIZE || (ahp->flags & ANON_ALLOC_FORCE)) {
483 ap_addr = (uintptr_t *)&ahp->array_chunk[an_idx];
489 ppp = &ahp->array_chunk[an_idx >> ANON_CHUNK_SHIFT];
493 mutex_enter(&ahp->serial_lock);
494 ppp = &ahp->array_chunk[an_idx >> ANON_CHUNK_SHIFT];
498 mutex_exit(&ahp->serial_lock);
502 mutex_exit(&ahp->serial_lock);
631 anon_grow(struct anon_hdr *ahp, ulong_t *startidx_p, pgcnt_t oldseg_pgs,
635 pgcnt_t oldamp_pgs = ahp->size, newamp_pgs;
644 ASSERT(startidx + oldseg_pgs <= ahp->size);
673 if (totpages <= ANON_CHUNK_SIZE || (ahp->flags & ANON_ALLOC_FORCE)) {
691 !(ahp->flags & ANON_ALLOC_FORCE)) {
699 level2 = (void *)ahp->array_chunk;
708 ANON_INITBUF(ahp->array_chunk, oldarrsz,
710 kmem_free(ahp->array_chunk, oldarrsz);
720 ANON_INITBUF(ahp->array_chunk, oldarrsz,
722 kmem_free(ahp->array_chunk, oldarrsz);
725 ahp->array_chunk = level1;
726 ahp->size = newamp_pgs;
1106 anon_szcshare(struct anon_hdr *ahp, ulong_t anon_index)
1111 ap = anon_get_ptr(ahp, anon_index);
1132 anon_share(struct anon_hdr *ahp, ulong_t anon_index, pgcnt_t nslots)
1137 if ((ap = anon_get_ptr(ahp, anon_index)) != NULL &&
1148 struct anon_hdr *ahp,
1152 struct anon *ap = anon_get_ptr(ahp, an_idx);
1167 ASSERT(an_idx < ahp->size);
1169 if (ahp->size - an_idx < pgcnt) {
1174 pgcnt = ahp->size - an_idx;
1186 ASSERT(!anon_share(ahp, an_idx, pgcnt));
1194 if ((ap = anon_get_ptr(ahp, an_idx + i)) == NULL) {
1209 (void) anon_set_ptr(ahp, an_idx + i, NULL,
1249 ap = anon_get_ptr(ahp, an_idx + j);
1272 ap = anon_get_ptr(ahp, an_idx + j);
1276 (void) anon_set_ptr(ahp, an_idx + j,
1311 (void) anon_set_ptr(ahp, an_idx + i, NULL, ANON_SLEEP);
1488 struct anon_hdr *ahp,
1518 if (anon_get_next_ptr(ahp, &index) == NULL) {
1522 ASSERT(!ANON_ISBUSY(anon_get_slot(ahp, index)));
1541 if ((ap = anon_get_ptr(ahp, an_idx)) == NULL) {
1562 (void) anon_set_ptr(ahp, an_idx, ap,
1583 anon_free(struct anon_hdr *ahp, ulong_t index, size_t size)
1593 if ((ap = anon_get_next_ptr(ahp, &index)) == NULL)
1596 ASSERT(!ANON_ISBUSY(anon_get_slot(ahp, index)));
1601 (void) anon_set_ptr(ahp, index, NULL, ANON_SLEEP);
1613 struct anon_hdr *ahp,
1628 ASSERT(an_idx < ahp->size);
1638 if (anon_get_next_ptr(ahp, &index) == NULL)
1641 ASSERT(!ANON_ISBUSY(anon_get_slot(ahp, index)));
1653 anon_decref_pages(ahp, index, szc);
1676 struct anon_hdr *ahp = amp->ahp;
1691 if ((ap = anon_get_next_ptr(ahp, &index)) == NULL)
1702 ap = anon_get_ptr(ahp, index);
1779 (void) anon_set_ptr(ahp, index,
1847 ap = anon_get_ptr(ahp, index + i);
2007 if ((ap = anon_get_ptr(amp->ahp, start_idx)) != NULL) {
2030 (void) anon_set_ptr(amp->ahp, start_idx, ap,
2046 ap = anon_get_ptr(amp->ahp, start_idx);
2075 !anon_szcshare(amp->ahp, start_idx)) {
2098 if ((ap = anon_get_ptr(amp->ahp, an_idx)) !=
2139 if ((ap = anon_get_ptr(amp->ahp, an_idx)) == NULL) {
2231 anon_share(amp->ahp, an_idx, npgs)) {
2278 (void) anon_set_ptr(amp->ahp, an_idx, ap, ANON_SLEEP);
2367 !anon_szcshare(amp->ahp, start_idx)) {
2573 ap = anon_get_ptr(amp->ahp, start_idx);
2604 ASSERT(!anon_share(amp->ahp, start_idx, pgcnt));
2674 oldap = anon_get_ptr(amp->ahp, an_idx);
2762 (void) anon_set_ptr(amp->ahp, an_idx, ap, ANON_SLEEP);
2890 ap = anon_get_ptr(amp->ahp, index);
2948 anon_pages(amp->ahp, index, pg_cnt) == 0) {
2999 ASSERT(anon_get_ptr(amp->ahp, index) == NULL);
3000 (void) anon_set_ptr(amp->ahp, index, ap, ANON_SLEEP);
3043 ASSERT(anon_get_ptr(amp->ahp, index) == NULL);
3044 (void) anon_set_ptr(amp->ahp, index, ap, ANON_SLEEP);
3065 struct anon_hdr *ahp,
3084 ASSERT(sidx < ahp->size);
3091 ap = anon_get_ptr(ahp, sidx);
3111 if (ahp->size - sidx < pgcnt) {
3113 pgcnt = ahp->size - sidx;
3116 ap = anon_get_ptr(ahp, sidx);
3214 if (anon_try_demote_pages(amp->ahp, start_idx, szc, ppa, 1)) {
3226 ap = anon_get_ptr(amp->ahp, an_idx);
3286 struct anon_hdr *ahp = amp->ahp;
3295 ASSERT(eidx <= ahp->size);
3296 ASSERT(!anon_share(ahp, sidx, btopr(len)));
3304 (eidx < sidx_aligned + pages && eidx < ahp->size)) {
3305 if (!anon_try_demote_pages(ahp, sidx_aligned,
3312 anon_free(ahp, sidx, size);
3320 anon_free_pages(ahp, sidx,
3330 if (eidx != ahp->size && anon_get_next_ptr(ahp, &tidx) != NULL &&
3332 if (!anon_try_demote_pages(ahp, sidx, amp->a_szc, NULL, 0)) {
3336 anon_free(ahp, sidx, size);
3338 anon_free_pages(ahp, sidx, pages << PAGESHIFT, amp->a_szc);
3405 amp->ahp = anon_create(btopr(size), flags);
3406 if (amp->ahp == NULL) {
3428 ASSERT(amp->ahp != NULL);
3435 anon_release(amp->ahp, btopr(amp->size));
3447 non_anon(struct anon_hdr *ahp, ulong_t anon_idx, u_offset_t *offp,
3456 ap = anon_get_ptr(ahp, anon_idx);
3482 anon_pages(struct anon_hdr *ahp, ulong_t anon_index, pgcnt_t nslots)
3487 if ((anon_get_ptr(ahp, anon_index)) != NULL)
3563 anon_get_slot(struct anon_hdr *ahp, ulong_t an_idx)
3568 ASSERT(an_idx < ahp->size);
3573 if ((ahp->size <= ANON_CHUNK_SIZE) || (ahp->flags & ANON_ALLOC_FORCE)) {
3574 return ((ulong_t *)&ahp->array_chunk[an_idx]);
3580 ppp = &ahp->array_chunk[an_idx >> ANON_CHUNK_SHIFT];
3582 mutex_enter(&ahp->serial_lock);
3583 ppp = &ahp->array_chunk[an_idx >> ANON_CHUNK_SHIFT];
3586 mutex_exit(&ahp->serial_lock);
3615 ap_slot = anon_get_slot(amp->ahp, an_idx);
3649 ap_slot = anon_get_slot(amp->ahp, an_idx);