From 1c35e213f1438ef5930eb655b71ae9978a80e665 Mon Sep 17 00:00:00 2001 From: Bosko Milekic Date: Wed, 20 Aug 2003 18:22:06 +0000 Subject: [PATCH] In sysctl_vm_zone, do not calculate per-cpu cache stats on UMA_ZFLAG_INTERNAL zones at all. Apparently, Wilko's alpha was crashing while entering multi-user because, I think, we were calculating the garbage cachefree for pcpu caches that essentially don't exist for at least the 'zones' zone and it so happened that we were reading from an unmapped location. Confirmed to fix crash: wilko Helped debug: wilko, gallatin --- sys/vm/uma_core.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 884f72172762..cc3884fa25d4 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -2167,30 +2167,27 @@ sysctl_vm_zone(SYSCTL_HANDLER_ARGS) LIST_FOREACH(z, &uma_zones, uz_link) { if (cnt == 0) /* list may have changed size */ break; - for (cpu = 0; cpu < maxcpu; cpu++) { - if (CPU_ABSENT(cpu)) - continue; - CPU_LOCK(cpu); + if (!(z->uz_flags & UMA_ZFLAG_INTERNAL)) { + for (cpu = 0; cpu < maxcpu; cpu++) { + if (CPU_ABSENT(cpu)) + continue; + CPU_LOCK(cpu); + } } ZONE_LOCK(z); cachefree = 0; - for (cpu = 0; cpu < maxcpu; cpu++) { - if (CPU_ABSENT(cpu)) - continue; - cache = &z->uz_cpu[cpu]; - if (cache->uc_allocbucket != NULL) - cachefree += cache->uc_allocbucket->ub_ptr + 1; - if (cache->uc_freebucket != NULL) - cachefree += cache->uc_freebucket->ub_ptr + 1; - CPU_UNLOCK(cpu); + if (!(z->uz_flags & UMA_ZFLAG_INTERNAL)) { + for (cpu = 0; cpu < maxcpu; cpu++) { + if (CPU_ABSENT(cpu)) + continue; + cache = &z->uz_cpu[cpu]; + if (cache->uc_allocbucket != NULL) + cachefree += cache->uc_allocbucket->ub_ptr + 1; + if (cache->uc_freebucket != NULL) + cachefree += cache->uc_freebucket->ub_ptr + 1; + CPU_UNLOCK(cpu); + } } - /* - * The "UMA Zones" zone (master zone) does not have pcpu - * caches allocated for it, so the above computation is entirely - * bogus. Re-set cachefree to 0 in that case. - */ - if (z == zones) - cachefree = 0; LIST_FOREACH(bucket, &z->uz_full_bucket, ub_link) { cachefree += bucket->ub_ptr + 1; }