Index: sys/vm/uma_core.c =================================================================== --- sys/vm/uma_core.c +++ sys/vm/uma_core.c @@ -258,7 +258,7 @@ static int zero_init(void *, int, int); static void keg_small_init(uma_keg_t keg); static void keg_large_init(uma_keg_t keg); -static void zone_foreach(void (*zfunc)(uma_zone_t)); +static void zone_foreach(void (*zfunc)(uma_zone_t), bool caching_zones); static void zone_timeout(uma_zone_t zone); static int hash_alloc(struct uma_hash *, u_int); static int hash_expand(struct uma_hash *, struct uma_hash *); @@ -550,7 +550,7 @@ uma_timeout(void *unused) { bucket_enable(); - zone_foreach(zone_timeout); + zone_foreach(zone_timeout, false); /* Reschedule this event */ callout_reset(&uma_callout, UMA_TIMEOUT * hz, uma_timeout, NULL); @@ -892,7 +892,7 @@ if (zone) cache_shrink(zone); else - zone_foreach(cache_shrink); + zone_foreach(cache_shrink, true); CPU_FOREACH(cpu) { thread_lock(curthread); @@ -902,7 +902,7 @@ if (zone) cache_drain_safe_cpu(zone); else - zone_foreach(cache_drain_safe_cpu); + zone_foreach(cache_drain_safe_cpu, false); } thread_lock(curthread); sched_unbind(curthread); @@ -2011,7 +2011,7 @@ * Nothing */ static void -zone_foreach(void (*zfunc)(uma_zone_t)) +zone_foreach(void (*zfunc)(uma_zone_t), bool caching_zones) { uma_keg_t keg; uma_zone_t zone; @@ -2027,6 +2027,10 @@ LIST_FOREACH(zone, &keg->uk_zones, uz_link) zfunc(zone); } + if (caching_zones) { + LIST_FOREACH(zone, &uma_cachezones, uz_link) + zfunc(zone); + } if (__predict_true(booted == BOOT_RUNNING)) rw_runlock(&uma_rwlock); } @@ -2204,7 +2208,7 @@ uma_dbg_cnt = counter_u64_alloc(M_WAITOK); uma_skip_cnt = counter_u64_alloc(M_WAITOK); #endif - zone_foreach(zone_alloc_counters); + zone_foreach(zone_alloc_counters, true); callout_init(&uma_callout, 1); callout_reset(&uma_callout, UMA_TIMEOUT * hz, uma_timeout, NULL); booted = BOOT_RUNNING; @@ -3731,14 +3735,14 @@ switch (req) { case UMA_RECLAIM_TRIM: - zone_foreach(zone_trim); + zone_foreach(zone_trim, true); break; case UMA_RECLAIM_DRAIN: case UMA_RECLAIM_DRAIN_CPU: - zone_foreach(zone_drain); + zone_foreach(zone_drain, false); if (req == UMA_RECLAIM_DRAIN_CPU) { pcpu_cache_drain_safe(NULL); - zone_foreach(zone_drain); + zone_foreach(zone_drain, false); } break; default: @@ -3911,7 +3915,7 @@ void uma_print_stats(void) { - zone_foreach(uma_print_zone); + zone_foreach(uma_print_zone, true); } static void