| 4525 | } |
| 4526 | |
| 4527 | static void |
| 4528 | zone_release(void *arg, void **bucket, int cnt) |
| 4529 | { |
| 4530 | struct mtx *lock; |
| 4531 | uma_zone_t zone; |
| 4532 | uma_slab_t slab; |
| 4533 | uma_keg_t keg; |
| 4534 | uint8_t *mem; |
| 4535 | void *item; |
| 4536 | int i; |
| 4537 | |
| 4538 | zone = arg; |
| 4539 | keg = zone->uz_keg; |
| 4540 | lock = NULL; |
| 4541 | if (__predict_false((zone->uz_flags & UMA_ZFLAG_HASH) != 0)) |
| 4542 | lock = KEG_LOCK(keg, 0); |
| 4543 | for (i = 0; i < cnt; i++) { |
| 4544 | item = bucket[i]; |
| 4545 | if (__predict_true((zone->uz_flags & UMA_ZFLAG_VTOSLAB) != 0)) { |
| 4546 | slab = vtoslab((vm_offset_t)item); |
| 4547 | } else { |
| 4548 | mem = (uint8_t *)((uintptr_t)item & (~UMA_SLAB_MASK)); |
| 4549 | if ((zone->uz_flags & UMA_ZFLAG_HASH) != 0) |
| 4550 | slab = hash_sfind(&keg->uk_hash, mem); |
| 4551 | else |
| 4552 | slab = (uma_slab_t)(mem + keg->uk_pgoff); |
| 4553 | } |
| 4554 | if (lock != KEG_LOCKPTR(keg, slab->us_domain)) { |
| 4555 | if (lock != NULL) |
| 4556 | mtx_unlock(lock); |
| 4557 | lock = KEG_LOCK(keg, slab->us_domain); |
| 4558 | } |
| 4559 | slab_free_item(zone, slab, item); |
| 4560 | } |
| 4561 | if (lock != NULL) |
| 4562 | mtx_unlock(lock); |
| 4563 | } |
| 4564 | |
| 4565 | /* |
| 4566 | * Frees a single item to any zone. |
nothing calls this directly
no test coverage detected