svn commit: r325734 - head/sys/amd64/amd64

Mateusz Guzik mjg at FreeBSD.org
Sun Nov 12 03:13:02 UTC 2017


Author: mjg
Date: Sun Nov 12 03:13:01 2017
New Revision: 325734
URL: https://svnweb.freebsd.org/changeset/base/325734

Log:
  amd64: stop nesting preemption counter in spinlock_enter
  
  Discussed with:	jhb

Modified:
  head/sys/amd64/amd64/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Sun Nov 12 02:34:33 2017	(r325733)
+++ head/sys/amd64/amd64/machdep.c	Sun Nov 12 03:13:01 2017	(r325734)
@@ -1853,9 +1853,9 @@ spinlock_enter(void)
 		flags = intr_disable();
 		td->td_md.md_spinlock_count = 1;
 		td->td_md.md_saved_flags = flags;
+		critical_enter();
 	} else
 		td->td_md.md_spinlock_count++;
-	critical_enter();
 }
 
 void
@@ -1865,11 +1865,12 @@ spinlock_exit(void)
 	register_t flags;
 
 	td = curthread;
-	critical_exit();
 	flags = td->td_md.md_saved_flags;
 	td->td_md.md_spinlock_count--;
-	if (td->td_md.md_spinlock_count == 0)
+	if (td->td_md.md_spinlock_count == 0) {
+		critical_exit();
 		intr_restore(flags);
+	}
 }
 
 /*


More information about the svn-src-all mailing list