MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zone_dtor

Function zone_dtor

freebsd/vm/uma_core.c:2806–2847  ·  view source on GitHub ↗

* Zone header dtor. * * Arguments/Returns follow uma_dtor specifications * udata unused */

Source from the content-addressed store, hash-verified

2804 * udata unused
2805 */
2806static void
2807zone_dtor(void *arg, int size, void *udata)
2808{
2809 uma_zone_t zone;
2810 uma_keg_t keg;
2811 int i;
2812
2813 zone = (uma_zone_t)arg;
2814
2815 sysctl_remove_oid(zone->uz_oid, 1, 1);
2816
2817 if (!(zone->uz_flags & UMA_ZFLAG_INTERNAL))
2818 cache_drain(zone);
2819
2820 rw_wlock(&uma_rwlock);
2821 LIST_REMOVE(zone, uz_link);
2822 rw_wunlock(&uma_rwlock);
2823 if ((zone->uz_flags & (UMA_ZONE_SECONDARY | UMA_ZFLAG_CACHE)) == 0) {
2824 keg = zone->uz_keg;
2825 keg->uk_reserve = 0;
2826 }
2827 zone_reclaim(zone, M_WAITOK, true);
2828
2829 /*
2830 * We only destroy kegs from non secondary/non cache zones.
2831 */
2832 if ((zone->uz_flags & (UMA_ZONE_SECONDARY | UMA_ZFLAG_CACHE)) == 0) {
2833 keg = zone->uz_keg;
2834 rw_wlock(&uma_rwlock);
2835 LIST_REMOVE(keg, uk_link);
2836 rw_wunlock(&uma_rwlock);
2837 zone_free_item(kegs, keg, NULL, SKIP_NONE);
2838 }
2839 counter_u64_free(zone->uz_allocs);
2840 counter_u64_free(zone->uz_frees);
2841 counter_u64_free(zone->uz_fails);
2842 counter_u64_free(zone->uz_xdomain);
2843 free(zone->uz_ctlname, M_UMA);
2844 for (i = 0; i < vm_ndomains; i++)
2845 ZDOM_LOCK_FINI(ZDOM_GET(zone, i));
2846 ZONE_CROSS_LOCK_FINI(zone);
2847}
2848
2849static void
2850zone_foreach_unlocked(void (*zfunc)(uma_zone_t, void *arg), void *arg)

Callers

nothing calls this directly

Calls 6

sysctl_remove_oidFunction · 0.85
cache_drainFunction · 0.85
zone_reclaimFunction · 0.85
zone_free_itemFunction · 0.85
counter_u64_freeFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected