Add vmem locking to r281026.

While races there are not fatal, they cause result underestimation, that
cause unneeded ARC reclaims.

MFC after:	1 month
This commit is contained in:
Alexander Motin 2015-04-05 14:17:26 +00:00
parent ba29f2ddfb
commit cdd09fea28

View File

@ -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");