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");
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to