diff options
author | mav <mav@FreeBSD.org> | 2015-04-05 14:17:26 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-04-05 14:17:26 +0000 |
commit | 31390ca6751f5ea7382dfec6472bc3a13ed67e1b (patch) | |
tree | 3c11039396ad339cbadc931d347a075c9949c1e4 | |
parent | 5bcf10a834727b8fe3443cc74c05e927c2b855c3 (diff) | |
download | FreeBSD-src-31390ca6751f5ea7382dfec6472bc3a13ed67e1b.zip FreeBSD-src-31390ca6751f5ea7382dfec6472bc3a13ed67e1b.tar.gz |
Add vmem locking to r281026.
While races there are not fatal, they cause result underestimation, that
cause unneeded ARC reclaims.
MFC after: 1 month
-rw-r--r-- | sys/kern/subr_vmem.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/subr_vmem.c b/sys/kern/subr_vmem.c index 47e583b..80940be 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"); |