svn commit: r281108 - head/sys/kern

Alexander Motin mav at FreeBSD.org
Sun Apr 5 14:17:28 UTC 2015


Author: mav
Date: Sun Apr  5 14:17:26 2015
New Revision: 281108
URL: https://svnweb.freebsd.org/changeset/base/281108

Log:
  Add vmem locking to r281026.
  
  While races there are not fatal, they cause result underestimation, that
  cause unneeded ARC reclaims.
  
  MFC after:	1 month

Modified:
  head/sys/kern/subr_vmem.c

Modified: head/sys/kern/subr_vmem.c
==============================================================================
--- head/sys/kern/subr_vmem.c	Sun Apr  5 14:06:11 2015	(r281107)
+++ head/sys/kern/subr_vmem.c	Sun Apr  5 14:17:26 2015	(r281108)
@@ -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");


More information about the svn-src-all mailing list