svn commit: r327914 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Sat Jan 13 09:26:25 UTC 2018


Author: mjg
Date: Sat Jan 13 09:26:24 2018
New Revision: 327914
URL: https://svnweb.freebsd.org/changeset/base/327914

Log:
  sx: retry hard shared unlock just like in r327905 for rwlocks

Modified:
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Sat Jan 13 08:28:46 2018	(r327913)
+++ head/sys/kern/kern_sx.c	Sat Jan 13 09:26:24 2018	(r327914)
@@ -1193,7 +1193,7 @@ _sx_sunlock_try(struct sx *sx, uintptr_t *xp)
 static void __noinline
 _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_LINE_ARG_DEF)
 {
-	int wakeup_swapper;
+	int wakeup_swapper = 0;
 	uintptr_t setx;
 
 	if (SCHEDULER_STOPPED())
@@ -1213,6 +1213,9 @@ _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_
 	for (;;) {
 		MPASS(x & SX_LOCK_EXCLUSIVE_WAITERS);
 		MPASS(!(x & SX_LOCK_SHARED_WAITERS));
+		if (_sx_sunlock_try(sx, &x))
+			break;
+
 		/*
 		 * Wake up semantic here is quite simple:
 		 * Just wake up all the exclusive waiters.


More information about the svn-src-all mailing list