svn commit: r208912 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Tue Jun 8 16:17:47 UTC 2010


Author: jhb
Date: Tue Jun  8 16:17:47 2010
New Revision: 208912
URL: http://svn.freebsd.org/changeset/base/208912

Log:
  Fix a sign bug that caused adaptive spinning in sx_xlock() to not work
  properly.  Among other things it did not drop Giant while spinning
  leading to livelocks.
  
  Reviewed by:	rookie, kib, jmallett
  MFC after:	3 days

Modified:
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Tue Jun  8 16:17:25 2010	(r208911)
+++ head/sys/kern/kern_sx.c	Tue Jun  8 16:17:47 2010	(r208912)
@@ -511,7 +511,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 		 * running or the state of the lock changes.
 		 */
 		x = sx->sx_lock;
-		if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) != 0) {
+		if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) {
 			if ((x & SX_LOCK_SHARED) == 0) {
 				x = SX_OWNER(x);
 				owner = (struct thread *)x;


More information about the svn-src-head mailing list