From cdd09fea282b7f46846cd07a4dd558d75fae83ae Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Sun, 5 Apr 2015 14:17:26 +0000 Subject: [PATCH] Add vmem locking to r281026. While races there are not fatal, they cause result underestimation, that cause unneeded ARC reclaims. MFC after: 1 month --- sys/kern/subr_vmem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/subr_vmem.c b/sys/kern/subr_vmem.c index 47e583b2534..80940be4410 100644 --- a/sys/kern/subr_vmem.c +++ b/sys/kern/subr_vmem.c @@ -1330,12 +1330,15 @@ vmem_size(vmem_t *vm, int typemask) case VMEM_FREE|VMEM_ALLOC: return vm->vm_size; case VMEM_MAXFREE: + VMEM_LOCK(vm); for (i = VMEM_MAXORDER - 1; i >= 0; i--) { if (LIST_EMPTY(&vm->vm_freelist[i])) continue; + VMEM_UNLOCK(vm); return ((vmem_size_t)ORDER2SIZE(i) << vm->vm_quantum_shift); } + VMEM_UNLOCK(vm); return (0); default: panic("vmem_size");