Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2017 03:13:01 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325734 - head/sys/amd64/amd64
Message-ID:  <201711120313.vAC3D1o4074273@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
+	}
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711120313.vAC3D1o4074273>