As an additional note, I switched from spinlock_t to kmutex_t because the critical sections protected by kstat_lock involve allocations where KM_SLEEP is used. Having a spin lock wait on KM_SLEEP is a waste of CPU time.