]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: less checking in non-debug builds
authorVMware, Inc <>
Tue, 13 Mar 2012 19:58:51 +0000 (12:58 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Tue, 13 Mar 2012 22:42:58 +0000 (15:42 -0700)
Remove checking from non-debug builds. The original requirements
called for checking all the time but this is turning out to be
too expensive. Times in NS/Cycles (exclusive lock, uncontended):

Before: 44/177
After:  39/103
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/lock/ulExcl.c
open-vm-tools/lib/lock/ulRec.c

index 0ea0e35544e1d6788a5fb91c93afc5077c5731fd..1ca7d9fbd99abdaad309a0689f4fff22e4d6bc1c 100644 (file)
@@ -425,7 +425,7 @@ MXUser_AcquireExclLock(MXUserExclLock *lock)  // IN/OUT:
                        NULL);                 // non-stats
    }
 
-   if (MXRecLockCount(&lock->recursiveLock) > 1) {
+   if (vmx86_debug && (MXRecLockCount(&lock->recursiveLock) > 1)) {
       MXUserDumpAndPanic(&lock->header,
                          "%s: Acquire on an acquired exclusive lock\n",
                          __FUNCTION__);
@@ -477,7 +477,7 @@ MXUser_ReleaseExclLock(MXUserExclLock *lock)  // IN/OUT:
       }
    }
 
-   if (!MXRecLockIsOwner(&lock->recursiveLock)) {
+   if (vmx86_debug && !MXRecLockIsOwner(&lock->recursiveLock)) {
       uint32 lockCount = MXRecLockCount(&lock->recursiveLock);
 
       MXUserDumpAndPanic(&lock->header,
index 45523055aceed62a039497e35983c3f6a1199102..8e75e5002ee8f76584bed2cf8ee89e9c7193390e 100644 (file)
@@ -590,7 +590,7 @@ MXUser_ReleaseRecLock(MXUserRecLock *lock)  // IN/OUT:
          }
       }
 
-      if (!MXRecLockIsOwner(&lock->recursiveLock)) {
+      if (vmx86_debug && !MXRecLockIsOwner(&lock->recursiveLock)) {
          uint32 lockCount = MXRecLockCount(&lock->recursiveLock);
 
          MXUserDumpAndPanic(&lock->header,